Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Drop down toggle jQuery

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35569

    I think I may be making this harder than it should be. So I’m currently working on this drop down where a user clicks on the link and then it show the particular content. It is basically like a tab however the user needs to hide the content. But the issue I am having is the drop down from the first link to the next link work (closes the first, shows the second). However when they click on the first again it doesn’t show anything. Basically it’s displaying the div but still hiding it’s contents.

    Any help would be appreciated!!

    http://jsfiddle.net/dYWmH/1/

    #92386
    davidlab.be
    Participant

    Here is a simple solution….untested.(meaning live site) Replace your jQuery with this:

     $(document).ready(function() {
    $('#containers, #sizes').hide();


    $('a#more_cat').click(function(){
    $('div#containers').fadeIn(2000);
    $('div#sizes').hide();
    });

    $('a#more_sizes').click(function(){
    $('div#sizes').fadeIn(2000);
    $('div#containers').hide();
    });
    });

    And then delete the property display:none; from #container, #sizes in your css because we are hiding the same divs with jQuery on page load.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.