www.webdeveloper.com
Results 1 to 5 of 5

Thread: Determine if a slidetoggle is hiding or showing

  1. #1
    Join Date
    Apr 2013
    Posts
    5

    Determine if a slidetoggle is hiding or showing

    I have a slide toggle on paragraphs within unique divs. These divs are wrapped in a "main" div. Is it possible to determine if the paragraph's are hidden or visible so that I can adjust the "main" div's height relative to the number of different paragraphs showing? You can see the issue on the bottom of my site http://joeeckloffdesigns.com/

    This is the script I'm using for the slide toggles…

    function () {
    $("#main p").hide() //hides all paragraphs on initial page load
    $("#design_dev span").click(function () {
    $("#design_dev p").slideToggle("slow");
    });
    $("#zen span").click(function () {
    $("#zen p").slideToggle("slow");
    });
    $("#redesigns span").click(function () {
    $("#redesigns p").slideToggle("slow");
    });
    $("#packaging .col_1 span").click(function () {
    $("#packaging .col_1 p").slideToggle("slow");
    });
    $("#packaging .col_2 span").click(function () {
    $("#packaging .col_2 p").slideToggle("slow");
    });
    }

    If there is anyway I could have improved this post please let me know. It's only my second and I'd like to learn to do them well.

    Thanks.

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,674
    what if you try $('#main').css('height','auto'); ?

  3. #3
    Join Date
    Apr 2013
    Posts
    56
    Well you can post code in code tags next time. It is easier to read that way. As to your problem you can check if element is visible like this
    Code:
     $("#your-id").is(":visible")
    . I hope this helps.

  4. #4
    Join Date
    Apr 2013
    Posts
    5
    Thanks coding123. That's what I needed.

  5. #5
    Join Date
    Apr 2013
    Posts
    5
    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles