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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    118
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Can't make script close link.

    Hi.

    I have been trying to find a how to make my script give me the option to click link to close it after link is clicked open.

    Currently can only click open. Doesn't work if click I on it after it opens wan't to click it closed.

    $('.nav-show').hide();

    $("li:has(ul)").click(function(){

    $("ul",this).slideDown();
    });
    Founder Of Riwaka Website Designs
    http://www.riwakawebsitedesigns.com

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,630
    Thanks
    6
    Thanked 1,002 Times in 975 Posts
    Code:
    $("li:has(ul)").click(function(){
      if($(this).hasClass('open')) {
        $(this).removeClass('open').find('ul').slideUp();
      }
      else {
       $(this).addClass('open').find('ul').slideDown();
      }
    });

  • Users who have thanked VIPStephan for this post:

    riwakawd (10-28-2013)

  • #3
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    118
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Thanks for that. was using my old code just now starting to learn more java script and php.
    Founder Of Riwaka Website Designs
    http://www.riwakawebsitedesigns.com


  •  

    Tags for this Thread

    Posting Permissions

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