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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:45:12+00:00 2026-05-26T21:45:12+00:00

I’ve got a simple menubar, seen here . My issue is that when you

  • 0

I’ve got a simple menubar, seen here. My issue is that when you hover over the tabs, and the sub-menu slides down, and then you hover over the slide menu, the tab goes off of its hover state.

Here’s my jQuery:

$('.js-tab').hover(function(){
    $(this).css('background-color', 'black').css('color', 'white').children('.js-icon').css('background-position', '0px -65px');
},function(){
    $(this).css('background-color', 'white').css('color', 'black').children('.js-icon').css('background-position', '0 0');
});

$('nav').hover(function(){
    $('.js-subitems').slideDown(150);
},function(){
    $('.js-subitems').slideUp(200);
});

.js-tab(s) are all the tabs. On hover, their css changes to invert the color, and select an inverted part of the sprite. ‘nav’ is the entire menu. Its size is dictated by the elements within it, it has no specific styling, I’m selecting it instead the tabs for the sub-menu so the sub-menu will stay up when you hover over it.

Here’s my CSS:

.js-subitems {
    background: rgba(0,0,0,.8);
    width: 539px;
    height: 170px;
    margin: 0 0 0 313px;
    border: 1px solid rgba(255,255,255,.5);
    border-top: 0px solid transparent;
    border-right: 1px solid rgba(0,0,0,.8);
    position: absolute;
    display: none;
    z-index: 7;
    padding: 15px;
    padding-top: 185px;
    color: white;
}

.js-icon{
    background-color:transparent;
    background-position:top left;
    background-repeat:no-repeat;
    position:absolute
}

.js-menu{
    float:left;
    width:570px;
    height: 340px;
    position:relative;
    margin-left:313px;
    border-left: 1px solid #CCC;
    z-index:10
}

.js-menu li{
    float:left;
    border-right:1px solid #CCC
}

.js-tab{
    background:#fff;
    display:block;
    overflow:hidden;
    position:relative;
    text-align:center;
    width:94px;
    height:170px;
    text-decoration:none;
    z-index:8
}

.js-tab h2{
    font-size:13px;
    font-weight:500;
    left:0;
    position:absolute;
    top:120px;
    width:97px;
    text-decoration:none
}

NOTE: Although the background color can be changed without use of javascript, I’m trying to keep all of it in the same place. I’ll slim this down later, compression is not important at the moment.

What I need, is a to add some jQuery so that when you move your cursor from the tab onto that sub-menu, the tab you had moved from stays selected. Then, when you hover from that sub-menu, back onto a tab in the menubar, tat tab becomes selected.

  • 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-26T21:45:13+00:00Added an answer on May 26, 2026 at 9:45 pm

    I think binding the hover event to only the li should work:

    $('#js-menu li).hover(function(){
        $(this).find('.js-tab').css('background-color', 'black').css('color', 'white').children('.js-icon').css('background-position', '0px -65px');
        $(this).find('.js-subitems').slideDown(150);
    },function(){
        $(this).find('.js-tab').css('background-color', 'white').css('color', 'black').children('.js-icon').css('background-position', '0 0');
        $(this).find('.js-subitems').slideUp(200);
    });
    

    That will trigger both changes that you need. However, I would also put each sub item list within the li as well, like this:

    <li data-hovercolor="#fff">
        <a href="/" class="js-tab">
        <h2 data-type="mText" class="js-item">Home</h2>
        <span data-type="icon" class="js-icon js-icon-home"></span>
        </a>
        <div class="js-subitems">
            Testing the text.
        </div>
    </li>
    

    This way, since the sub items are part of the parent li, the parent li will keep the hover effect on when mousing over the sub items.

    EDIT: After some discussion, a new solution was needed. I am pretty sure this should be working for what you need: http://jsfiddle.net/jackrugile/SkhqF/

    It changes the duration based on whether the ul is being hovered over or not, and applies a small setTimeout to handle the animation when leaving the ul. Thanks to @GregL’s answer for inspiration.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
i got an object with contents of html markup in it, for example: string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

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.