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 9215041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:06:44+00:00 2026-06-18T02:06:44+00:00

I have a vertical 2 level jQuery menu, and I’d need that after a

  • 0

I have a vertical 2 level jQuery menu, and I’d need that after a link has been clicked and the new page loaded, the menu stay open with the selected link highlighted.
Here is my menu code:

<div id="my-menu">
    <ul>
        <li><span class="toggle">Una Passione</span>
            <ul>
                <li><a href="Trefratelli.aspx">Tre Fratelli</a></li>
                <li><a href="Conlenostremani.aspx">Con le nostre mani</a></li>
                <li><a href="#">La nostra storia</a></li>
                <li><a href="#">Il video</a></li>
                <li><a href="Libro.aspx">Il libro</a></li>
            </ul>
        </li>
        <li><span class="toggle">Icone</span>
            <ul>
                <li><a href="Icone_Brera.aspx">Brera</a></li>
                <li><a href="Icone_Magenta.aspx">Magenta</a></li>
            </ul>
        </li>
    </ul>
</div>

and here the jQuery code:

$(document).ready(function() {

    $("span.toggle").next().hide();
    $("span.toggleinterno").next().hide();

    $("#my-menu a, #my-menu span.toggle").click(function() {
        $(this).stop().animate( {
            color:"red"
        }, 300);
    });

    $("span.toggle").click(function() {
        if ($(this).hasClass('second')) {
            $(this).removeClass('second');
        } else {
            $(this).addClass('second');
        }
    });  

    $("#my-menu a, #my-menu span.toggleinterno").click(function() {
        $(this).stop().animate( {
            fontSize:"17px",
            //paddingLeft:"10px",
            color:"black"
        }, 300);
    }, function() {
        $(this).stop().animate( {
            //fontSize:"14px",
            paddingLeft:"15",
            color:"#808080"
        }, 300);
    });

    $("span.toggle").css("cursor", "pointer");
    $("span.toggleinterno").css("cursor", "pointer");

    $("span.toggle").click(function() {
        $(this).next().toggle(1000);
    });

    $("span.toggleinterno").click(function() {
        $("span.toggleinterno").css("width", "100px");
        $(this).next().toggle(1000);
    });
});
  • 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-18T02:06:46+00:00Added an answer on June 18, 2026 at 2:06 am

    You could try something like this:

    var url = window.location.pathname.match(/.*\/(.*)$/)[1];
    var $activelink =  $('#my-menu a[href="' + url + '"]');
    var $openmenu = $('#my-menu ul ul').has(activelink);
    
    $activelink.addClass('hilight');
    $openmenu.show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that has no vertical scroll, rather, everything is displayed horizontally.
I have an expandable vertical drop down menu that currently expands when first level
i'm trying to make 3 level vertical menu i have 2 level, but its
I have a CSS vertical menu I have created code is below. (Test page
I have a problem with a vertical css menu with 3-level submenus.The last submenu
I am new to jQuery. I have jQuery code to create a accordion vertical
I have a vertical menu having an item Click here to get the scientific
I have the following ul setup: <div id=sidebar> <ul id=themenu class=sf-menu sf-vertical> <li> <a
I have a block level element which I am centering on the page. I
I have a side vertical menu, with sub pages (sub <ul> ). I have

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.