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 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2011
    Posts
    81
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Toggle won't close.

    Hi!

    I'm trying to make something in jQuery that opens and closes (well, hides) divs when I click on them.

    So first I have this:

    Code:
    $('#div1, #div2').hide();
    just to hide all the divs when I open up the page.

    Then for each div I have this code:
    Code:
    $('.div1click').click(function() {
    	  $('.ffclickclass').hide();
    	  $('#div1').fadeToggle(700);
    	  return false;
    	});
    When I remove the line "$('.ffclickclass').hide();" it works fine. But I need this line in order to close every div when I click on a another link, otherwise I end up with a load of divs underneath each other, and I just want one at the time.

    Anyone got an idea on how to make the div hide again by clicking a second time?

  • #2
    New Coder
    Join Date
    Oct 2011
    Posts
    81
    Thanks
    1
    Thanked 0 Times in 0 Posts
    It's been solved. Just had to add .not to the hide.


  •  

    Posting Permissions

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