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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:49:54+00:00 2026-06-14T22:49:54+00:00

I am trying to delay or stop the menu from slideUp action when a

  • 0

I am trying to delay or stop the menu from slideUp action when a user hover off the menu by accident and then hovering again. I am trying to prevent the menu from sliding up when a user unintentionally rolls off the hover area. I want the user to hover back within a split second and not have the menu to slide up.

I used the delay function below as this does not prevent the menu from sliding up. Thanks.

$(document).ready(function() {
$('#nav li').hover(
    function () {
        //show its submenu
        $('ul', this).slideDown(250);

    }, 
    function () {
        //hide its submenu
        $('ul', this).delay(1000).slideUp(500);         
    }
);
});

Demo: http://jsfiddle.net/D3A5g/

Here is a suggestion Nelson posted. It work on jsfiddle but not on my pages. Can anyone tell me what is preventing from working on my page?

Working Demo: http://jsfiddle.net/xwAdG/6/

Below code does not work when I test it. Any ideas why it’s not working?

<html>
<head>
<style type="text/css">
#nav {
padding: 40px;
border: solid #999 1px;
}
#nav ul {
margin: 0;
padding: 0;
display: none;
background-color: #CCC;
}
#nav ul li {
margin: 0;
list-style: none;
list-style-type: none;
padding: 5px;
width: 40px;
}
#nav a {
color: black;
text-decoration: none;
padding: 5px;

}
#nav a:hover {
text-decoration: none;
background-color: yellow;
}​
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://cherne.net/brian/resources/jquery.hoverIntent.js"></script>
<script>
var config = {    
 over: function () { //onMouseOver callback (REQUIRED) 
    $('ul', this).slideDown(250);//show its submenu

},    
timeout: 500, // milliseconds delay before onMouseOut  (default 0)  
out: function () { // function = onMouseOut callback (REQUIRED)
    $('ul', this).slideUp(500); //hide its submenu        
}     
};
$('#nav li').hoverIntent(config);
</script>
</head>

<body>
<ul id="nav">
<li ><a href="#">Main</a>
<ul>
<li><a href="#">AAAAA</a></li>
<li><a href="#">BBBBB</a></li>
<li><a href="#">CCCCC</a></li>
<li><a href="#">DDDDD</a></li>
<li><a href="#">FFFFF</a></li>
</ul>
</li>
</ul>
</body>
</html>

UPDATE: I found out that I needed to wrap the code with $(document).ready. By doing this, it worked in a html page.

<script>
$(document).ready(function() {
var config = {    
over: function () { //onMouseOver callback (REQUIRED) 
$('ul', this).slideDown(250);//show its submenu

},    
timeout: 500, // milliseconds delay before onMouseOut  (default 0)  
out: function () { // function = onMouseOut callback (REQUIRED)
$('ul', this).slideUp(500); //hide its submenu        
}     
};
$('#nav li').hoverIntent(config);
});​
</script>
  • 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-14T22:49:55+00:00Added an answer on June 14, 2026 at 10:49 pm

    I recommend you the hoverIntent plugin for that, I’ve use it in some projects and very happy so far.

    Your posted code would be used with the plugin like this:

    var config = {    
         over: function () { //onMouseOver callback (REQUIRED) 
            $('ul', '#nav li').slideDown(250);//show its submenu
    
        },    
        timeout: 0, // milliseconds delay before onMouseOut  (default 0)  
        out: function () { // function = onMouseOut callback (REQUIRED)
            $('ul', '#nav li').slideUp(500); //hide its submenu        
        }     
    };
    $('#nav li').hoverIntent(config);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get my application to perform an action after a delay, but
I have the following jQuery code $(#dropdown).hover(function() { $(this).stop(true,true).fadeTo('fast',1); $(#options).stop(true,true).slideDown(); }, function() { $(this).delay(1000).stop(true,true).fadeTo('fast',0.1);
I'm trying to add a small delay in the .hover() callback before running further
I'm trying to add delay to a simple drop down menu. With the following
I am trying to stop an animation from propagating on a call back of
Im trying to add a delay that works on my dropdown menu if the
I'm trying to fade in / out text and then after so long stop
I'm trying to find a way to delay all code that takes place after
I'm trying to make some sort of delay in the view controllers changing. I
I'm trying to build a tool for testing the delay of my internet connection,

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.