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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:59:46+00:00 2026-06-14T13:59:46+00:00

Essentially I want to replicate li:hover+li but it’s a bit more complicated than that.

  • 0

Essentially I want to replicate li:hover+li but it’s a bit more complicated than that. I am playing around with CSS transitions and trying to make a dropdown menu that has a delay on closing (for usability). So in other words, when you move your mouse off the menu it doesn’t disappear instantly.

I got that working OK but when I move from one top level item to the next, the previous menu stays open for a second. Here is a simplified example without the dropdown, just transitioning the top level item. Relevant CSS:

.menu > li {
  background-color: #4F57AA;
  /* transition out */
  -webkit-transition: background-color .2s ease-in-out 1s;
}
.menu > li:hover {
  background-color: #8F002E;
  /* transition in */
  -webkit-transition: background-color .2s ease-in-out;
}
.menu > li:hover+li {
  -webkit-transition: background-color .2s ease-in-out;
}

So when you move off the menu entirely, the list item wait a second before fading back to blue. But when moving from “One” to “Two” the hover state on “One” also waits a second.

Using the sibling selector, I managed to get an instant transition when moving from right to left. Of course there is no “previous sibling” selector yet so it doesn’t work the other way round. I want to use a small bit of jQuery to trigger these transitions but this is where I’ve got stuck. I tried this:

$('.menu > li').hover(
  function() {
    // instant transition for siblings?
    $(this).siblings().css('-webkit-transition', 'background-color .2s ease-in-out');
  },
  function() {
    // revert to regular transition?
    $(this).siblings().css('-webkit-transition', 'background-color .2s ease-in-out 1s');
  }
);

But it doesn’t work. Any ideas?

  • 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-14T13:59:48+00:00Added an answer on June 14, 2026 at 1:59 pm

    I think you can get what you want with pure CSS. I’ve removed your last selector (using sibling) and pushed it up to the #2 cascade position and changed the selector to look for a .menu:hover first:

    .menu > li {
      background-color: #4F57AA;
      /* transition out */
      -webkit-transition: background-color .2s ease-in-out 1s;
    }
    
    .menu:hover > li {
      -webkit-transition: background-color .2s ease-in-out .2s;
    }
    
    .menu > li:hover {
      background-color: #8F002E;
      /* transition in */
      -webkit-transition: background-color .2s ease-in-out;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've gotten myself into a situation that seems fairly unusual, and essentially want to
Essentially what I want to do is to apply additional CSS classes to individual
I want to implement a view in an iPhone application that is essentially like
I am writing some JavaScript that what I essentially want to do is confirm
I essentially want to create a variable that would be executed every time. For
I have one table with 2 columns that i essentially want to split into
I essentially want to display a screen whenever the screen is unlocked regardless of
Essentially I want a border-less, black window which I can set the location and
Essentially I want to suck a line of text from a file, assign the
I have 3 date range forms on my site. Essentially I want to hide

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.