Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2010, 11:43 PM   PM User | #1
mapleleaf
New Coder

 
Join Date: May 2009
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
mapleleaf is an unknown quantity at this point
check if something is visible in jquery ui

I am sliding elements in and out of view but need to check if an element is visible so I know which function to call.

For example:

Code:
$("#one").click(function() {

//I need to check if the element #bonuses is visible at the time of clicking.
//If it is I will not run the below function. How is this done?
//The element is controlled by the slider in jquery ui
//I am thinking that maybe it is more about position than display
//but I cannot find it in the documentation.
//if (document.getElementById("bonuses").style.display = "none")
//did not work
			
				runEffectB();
			
			
			
			return false;
		});
mapleleaf is offline   Reply With Quote
Old 02-12-2010, 03:25 AM   PM User | #2
bdl
Regular Coder

 
Join Date: Apr 2007
Location: Camarillo, CA US
Posts: 590
Thanks: 4
Thanked 83 Times in 82 Posts
bdl is an unknown quantity at this point
Have you looked at the :visible selector?
bdl is offline   Reply With Quote
Old 02-12-2010, 04:34 AM   PM User | #3
mapleleaf
New Coder

 
Join Date: May 2009
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
mapleleaf is an unknown quantity at this point
I have tried this bit it isn't doing what I expect:

Code:
$("#one").click(function() {
			if($("#bonuses:visible")) {
				//do nothing
			}else
			{
				runEffectB();
			}
			
			
			
			return false;
		});
Syntax maybe??
mapleleaf is offline   Reply With Quote
Old 02-12-2010, 03:51 PM   PM User | #4
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
if( $('#bonuses').is(':visible')) {
Spudhead is offline   Reply With Quote
Users who have thanked Spudhead for this post:
mapleleaf (02-12-2010)
Old 02-12-2010, 07:17 PM   PM User | #5
mapleleaf
New Coder

 
Join Date: May 2009
Posts: 47
Thanks: 3
Thanked 0 Times in 0 Posts
mapleleaf is an unknown quantity at this point
Much Appreciated Spudhead.
Just what I needed.
Opens up a lot of things for me
mapleleaf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:02 AM.


Advertisement
Log in to turn off these ads.