Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts

    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;
    		});

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Have you looked at the :visible selector?

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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??

  • #4
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts

  • Users who have thanked Spudhead for this post:

    mapleleaf (02-12-2010)

  • #5
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Much Appreciated Spudhead.
    Just what I needed.
    Opens up a lot of things for me


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •