Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8865355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:29:08+00:00 2026-06-14T16:29:08+00:00

I am using this tutorial http://www.1stwebdesigner.com/css/create-sliding-navigation-menu-jquery/ this is the index.html file: !DOCTYPE html> Jquery

  • 0

I am using this tutorial

http://www.1stwebdesigner.com/css/create-sliding-navigation-menu-jquery/

this is the index.html file:

!DOCTYPE html> Jquery Sliding Navigation Menu

    <ul id='header_nav'>
        <li><img src="images/home-icon.png" /></li>
        <li>About Us</li>
        <li>Categories
            <ul>
                <li><a>Coding</a></li>
                <li><a>Freebies<span class="arrow-right"></span></a>
                    <ul>
                        <li><a>Icons<span class="items_num">5</span></a></li>
                        <li><a>Templates<span class="items_num">10</span></a></li>
                        <li><a>Fonts<span class="items_num">3</span></a></li>
                    </ul>
                </li>
                <li><a>Tutorial<span class="arrow-right"></span></a>
                    <ul>
                        <li><a>Icons<span class="items_num">5</span></a></li>
                        <li><a>Templates<span class="items_num">10</span></a></li>
                        <li><a>Fonts<span class="items_num">3</span></a></li>
                    </ul></li>
                <li><a>Web Design</a></li>
            </ul>
        </li>
        <li>Archive
            <ul>
                <li><a>Coding</a></li>
                <li><a>Freebies<span class="arrow-right"></span></a>
                    <ul>
                        <li><a>Icons<span class="items_num">5</span></a></li>
                        <li><a>Templates<span class="items_num">10</span></a></li>
                        <li><a>Fonts<span class="items_num">3</span></a></li>
                    </ul>
                </li>
                <li><a>Web Design</a></li>
            </ul>
        </li>
        <li>Contact</li>
        <li>Write For Us ?</li>
    </ul>



    <script>

        $(document).ready(function(){

            $("#header_nav > li ").addClass("level1");
            $("#header_nav  > li > ul > li ").addClass("level2");
            $("#header_nav  > li > ul > li > ul > li ").addClass("level3");

            $(".level1").live("hover",function(){

                $(".level1").removeClass("main_menu_hover");
                $(this).addClass("main_menu_hover");


                var numberofChildren = $(this).find("> ul").children().length;

                if(numberofChildren != 0){
                    // Section 1
                    $(".level1").removeClass("active_main_menu");
                    $(this).addClass("active_main_menu");

                    // Section 2
                    $(".level1").find("ul").css("display","none");
                    $(this).find(" > ul").css("display","block");

                    // Section 3
                    $(".level2").removeClass("active_first_element");
                    $(".level2").removeClass("active_last_element");
                    $(".level2").removeClass("active_only_element");

                    // Section 4
                    if(numberofChildren == 1){
                        $(this).find("ul li:first").addClass("active_only_element");
                    }else{
                        $(this).find("ul li:first").addClass("active_first_element");
                        $(this).find("ul li:last-child").addClass("active_last_element");
                    }

                    // Section 5
                    $(".level2 a").removeClass("sub_active");
                    $(".level2").removeClass("menu_hover");


                }else{
                    // Section 6
                    $(".level1").find("ul").css("display","none");
                    $(".level1").removeClass("active_main_menu");

                }

            });

            $(".level2").find(".arrow-right").attr("href","javascript:void(0);");

            $(".level2 > a").live("hover",function(e){
                $("li").removeClass("menu_hover");
                $(this).parent().addClass("menu_hover");
                e.preventDefault();
            });

            $(".level2 a").live("click",function(){
                $("li").removeClass("menu_hover");

                if($(this).hasClass("sub_active")){
                    $(this).removeClass("sub_active");
                    $(".level2 > ul").slideUp();
                }else{
                    $(".level2 ul").slideUp();
                    $(".level2 a").removeClass("sub_active");
                    $(this).addClass("sub_active");
                    $(this).parent().find("ul").slideDown();
                }
            });





            $(".level3 a").live("hover",function(){
                if(!($(this).parent().hasClass("accordian_element_hover"))){
                    $(this).parent().removeClass("level3").addClass("accordian_element_hover");
                }
            });
            $(".accordian_element_hover a").live("hover",function(){
                $(this).parent().addClass("level3").removeClass("accordian_element_hover");
            });


        });
    </script>

</body> </html>

I have been trying to figure out how to add a different click function to each of the drop dpwn elements.

I have used this:

$(".level2 a").live("click",function(){  
  return false;
});

and it works by adding the same function to every item in the drop down menu. I was wondering how to address each specific one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:29:10+00:00Added an answer on June 14, 2026 at 4:29 pm

    If the content is static, you can use something like $('.level2 a:eq(0)'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this tutorial to create a login form http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/ It authenticates against
I'm using this JQuery autocomplete plugin http://www.devbridge.com/projects/autocomplete/jquery/ in my project. I followed this tutorial
Using this tutorial: http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide I can get a Directory Listing to display when I
I'm using this tutorial to build an application using the MVC architecture : http://www.oracle.com/technetwork/articles/javase/index-142890.html
I'm using the Developer edition of Salesforce, following this tutorial: http://www.salesforce.com/us/developer/docs/fundamentals/index.htm I've got to
Using this tutorial: http://www.c-sharpcorner.com/uploadfile/UrmimalaPal/creating-a-windows-phone-7-application-consuming-data-using-a-wcf-service/ I have created sample/hello world application on the windows phone
Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
am using the application in this link http://www.jeasyui.com/tutorial/app/crud2.php .I have added one more column
I am using this code to send mail with php http://www.siteduzero.com/tutoriel-3-35146-e-mail-envoyer-un-e-mail-en-php.html#ss_part_4 . This code
Using this tutorial at this section 4.5 : http://www.vogella.de/articles/Android/article.html#first_uiproperties as a guide, I attempt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.