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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:10:53+00:00 2026-05-25T13:10:53+00:00

I have a list of links using wp_nav_menu so they’re easily editable by the

  • 0

I have a list of links using wp_nav_menu so they’re easily editable by the client. Those output a type of menu. Separate from that I have a group of custom posts that are directly tied to those list items. I want the information tied to the menu items to appear when I hover over the list items but STAY visible if I am also clicking on a link within them.

Below is the code I am currently using, which sort of works, but the items show periodically. Has anyone else tried to achieve this?

$('#nav > li').each(function(){
    var first = $(this).attr('class').replace(/^(\S*).*/, '$1')

    $(this).hover(function(){
        $('.programs').show(100);
        $('.program_home').addClass('visuallyhidden');
        $('#' + first).toggleClass('visuallyhidden');
    }, function() {
        $('#' + first).mouseout(function(){
            $(this).addClass('visuallyhidden');
            $('.programs').hide();
        });
    });
});

Also, my code for the page looks like this :

<section class="switcher">
    <nav class="grid_3">
        <ul id="nav" class="menu">
            <li id="menu-item-4512" class="busprof menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/business-professionals/"><strong>Business Professionals</strong><span class="desc">Courses &amp; Certificates for Business and Engineering professionals</span><span class="arrow"></span></a></li>
            <li id="menu-item-4516" class="creative_writing menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/creative-writing/"><strong>Creative Writing</strong><span class="desc"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec </span><span class="arrow"></span></a></li>
            <li id="menu-item-4528" class="languages menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/languages-translation/"><strong>Languages &#038; Translation</strong><span class="desc"> </span><span class="arrow"></span></a></li>
            <li id="menu-item-4527" class="arts_science menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/arts-science/"><strong>Arts &#038; Science</strong><span class="desc"> </span><span class="arrow"></span></a></li>
            <li id="menu-item-4526" class="elp menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/english-language-program/"><strong>English Language Program</strong><span class="desc"> </span><span class="arrow"></span></a></li>
            <li id="menu-item-4525" class="online menu-item menu-item-type-post_type menu-item-object-page"><a href="http://scs.cmsstaging.utoronto.ca/courses-programs/online-distance-learning/"><strong>Online &#038; Distance Learning</strong><span class="desc"> </span><span class="arrow"></span></a></li>
    </ul>
</nav>
<div class="programs">
    <dl id="online" class="visuallyhidden program_home">
        <dd>Defenition</dd>
            <dt class="classes">Definition Title</dt>
            <dd>
                <ul>
                    <li><a href="#">Link</a></li>
                </ul>
            </dd>
            <dd>
                <blockquote>excerpt</blockquote>
            </dd>
            <dt class="learn_more"><span>Learn</span> more.</dt>
        </dl>
        <dl id="elp" class="visuallyhidden program_home">
            <dd>Defenition</dd>
            <dt class="classes">Definition Title</dt>
            <dd>
                <ul> 
                    <li><a href="#">Link</a></li>
                </ul>
            </dd>
etc...
</section>

Modified the Top jQuery code to be :

$('#nav > li').each(function(){
    var first = $(this).attr('class').replace(/^(\S*).*/, '$1'), timer;

    $(this).hover(function(){
        clearTimeout(timer);
        $('.program_home').addClass('visuallyhidden');
        $('.programs').fadeIn(200);
        $('#' + first).removeClass('visuallyhidden');
    }, function() {
        timer = setTimeout(function(){
            $('#' + first).addClass('visuallyhidden');
            $('.programs').fadeOut(200);
        },75);
    });
    $('#' + first).hover(function(){
        clearTimeout(timer);
    },function(){
        $(this).addClass('visuallyhidden');
        $('.programs').hide();
    });
});

Based on suggestions. It works but looks buggy. I will be altering timing and class adjustments to see if it can be improved.

  • 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-05-25T13:10:53+00:00Added an answer on May 25, 2026 at 1:10 pm

    try this:

    $('#nav > li').each(function(){
        var first = $(this).attr('class').replace(/^(\S*).*/, '$1'), timer;
    
        $(this).hover(function(){
            $('.programs').show(100);
            $('.program_home').addClass('visuallyhidden');
            $('#' + first).toggleClass('visuallyhidden');
        }, function() {
            timer = setTimeout(function(){
                $('#' + first).addClass('visuallyhidden');
                $('.programs').hide();
            },10);
        });
        $('#' + first).hover(function(){
            clearTimeout(timer);
        },function(){
            $(this).addClass('visuallyhidden');
            $('.programs').hide();
        })
    });
    

    the basic idea is that if you mouse from the hovered element to the div, the hide code doesn’t happen, and if you mouse out of the div, the div gets hidden.

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

Sidebar

Related Questions

I have a long list of links that I spit out using the below
I have a list of links that link to sections within the page using
I have a list of links and I am using the following code to
I have a list of links that are using nested span elements as a
I have a method that loops through a list and creates Links using the
I have a list of links with number ids in the titles, using jQuery
I have a list with links I use with tabs. It looks like this:
I have a list with links. These links are links to tables on the
I need to have a list of links generated by JSF and displayed in
i have a unordered list of links, which are dynamically created by Ajax, and

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.