Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-03-2011, 10:49 AM   PM User | #1
Bubba Jones
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Bubba Jones is an unknown quantity at this point
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..
Bubba Jones is offline   Reply With Quote
Old 11-04-2011, 04:10 AM   PM User | #2
Bubba Jones
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Bubba Jones is an unknown quantity at this point
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.
Bubba Jones is offline   Reply With Quote
Old 11-04-2011, 08:51 AM   PM User | #3
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
Bubba Jones (11-05-2011)
Old 11-04-2011, 04:31 PM   PM User | #4
Bubba Jones
New to the CF scene

 
Join Date: Nov 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Bubba Jones is an unknown quantity at this point
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.
Bubba Jones is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:12 AM.


Advertisement
Log in to turn off these ads.