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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:54:04+00:00 2026-06-05T14:54:04+00:00

I am working on a website and want to modify the current code for

  • 0

I am working on a website and want to modify the current code for a dropdown menu item. Here is the current code:

$(document).ready(function () { 

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

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

});

I tried changing the code to add a timeout with the intention of setting the timeout when the user took their mouse off of the menu so the menu didn’t toggle the slide up effect right away. The desired effect that I want is that if the user takes their mouse off the menu for like 200 ms but then moves it back to the menu it doesn’t do anything. So the menu waits like 300-400 ms to toggle the slide up function. Here is the code that I wrote that didn’t work. Part of it was because of the this in $('ul', this).slideUp(250); Anyways, here is the code that I tried to implement that didn’t work:

$(document).ready(function () { 
var timeoutID;
$('#nav li').hover(
    function () {
        //show its submenu
        $('ul', this).slideDown(250);
        window.clearTimeout(timeoutID);
        timeoutID = window.setTimeout(SlideUp, 350);
    },  
);
function SlideUp() {
    //hide its submenu
    $('ul', this).slideUp(250);         
}
});

What is the best way to have the program wait to toggle the slideup function? Any ideas are appreciated. Thanks.

  • 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-05T14:54:06+00:00Added an answer on June 5, 2026 at 2:54 pm

    This is what you wanted to do.

    $(document).ready(function () { 
      var timeout;
      $('#nav li').hover(function () {
        //show its submenu
        clearTimeout(timeout);
        $('ul', this).slideDown(300);
      }, function () {
        //hide its submenu
        var self = this;
        timeout = setTimeout(function(){
          $('ul', self).slideUp(300);         
        }, 300);
      });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was working on my website and stuck there. My current code is here:
I am working on website in which i want to copy the file from
I've been working on a website lately and want to speed up my application.
hey i guys i want help from you. i am working on website project,
I'm working on a clients website and they want a simple check in page
I'm working on this website in WordPress and I want the content with the
I'm working on a website for my county's fair. I want to allow my
Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the
I'm working on an E-Book that will be published to my website. I want
I'm working on a website with some other people. Usually when we want to

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.