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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation I need help with a jQuery drop down navigation menu

    I need to be able to click anywhere to make the Portfolio menu close, not just click on the same tab. If you need me to explain more, just say so, and I'll do my best to help with a better explanation.

    Picture related:

    http://goo.gl/C4nKn

    Here is the jQuery I have so far:

    Code:
    (function ($) {
      $.fn.fixedMenu = function () {
        return this.each(function () {
          var menu = $(this);
          menu.find('ul li > a').bind('click', function () {
            //check whether the particular link has a dropdown
            if (!$(this).parent().hasClass('single-link') && !$(this).parent().hasClass('current')) {
              //hiding drop down menu when it is clicked again
              if ($(this).parent().hasClass('active')) {
                $(this).parent().removeClass('active');
              }
              else {
                //displaying the drop down menu
                $(this).parent().parent().find('.active').removeClass('active');
                $(this).parent().addClass('active');
              }
            }
            else {
              //hiding the drop down menu when some other link is clicked
              $(this).parent().parent().find('.active').removeClass('active');
    
            }
          })
        });
      }
    })(jQuery);
    Last edited by Bubba Jones; 11-04-2011 at 04:11 AM.

  • #2
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I'm not sure if I am allowed to self-bump once, but can anyone out there help me out or point me in the right direction? Anything would be much appreciated.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    Quote Originally Posted by Bubba Jones View Post
    I'm not sure if I am allowed to self-bump once, but can anyone out there help me out or point me in the right direction? Anything would be much appreciated.
    You should wait 2-3 days (not just a few hours) before bumping.

    You would be more likely to get a response if you posted in the jQuery (Javascript Frameworks) section of the forum. Ask a mod to move you over.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    Bubba Jones (11-05-2011)

  • #4
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    You should wait 2-3 days (not just a few hours) before bumping.

    You would be more likely to get a response if you posted in the jQuery (Javascript Frameworks) section of the forum. Ask a mod to move you over.
    Okay, and I contacted a mod. Thank you.


  •  

    Posting Permissions

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