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

  • Home
  • SEARCH
  • 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 8214807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:34:47+00:00 2026-06-07T11:34:47+00:00

so I managed to create a setTimout slideUp/Down function for a menu that works

  • 0

so I managed to create a setTimout slideUp/Down function for a menu that works great – but on certain occasions when the user hovers over links, and over their child links it rapidly slides up and down – I know this question is typical but I have tried different things unsuccessfully.

Here’s a working demo – you can see if you mouse over the links the function goes nuts
http://jsfiddle.net/eA2HL/2/

jQuery('.nav.mainmenu > li').each(function() {
    var t = null;
    var $this = jQuery(this);
    var result = jQuery('#result');
    $this.hover(function() {
        t = setTimeout(function() {
            if($this.find('ul').length > 0) {
                result.slideDown(200, function() {
                    if($this.is(':visible')) {
                        $this.find('ul').show();
                    }
                });
            }
            t = null;
        }, 300);
    }, function() {
        if (t) {
            clearTimeout(t);
            t = null;
        } else {
            $this.find('ul').hide(0);
            result.slideUp(333, function() {
                $this.find('ul').hide(0);
            });
        }
    });
});
  • 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-07T11:34:48+00:00Added an answer on June 7, 2026 at 11:34 am

    Using .stop(1,1) (same as .stop( true , true )) will help to clear some animation buildups:

    jQuery('.nav.mainmenu > li').each(function() {
            var t = null;
            var $this = jQuery(this);
            var result = jQuery('#result');
            $this.hover(function() {
                t = setTimeout(function() {
                    if($this.find('ul').length > 0) {
                        result.stop(1,1).slideDown(200, function() {  // HERE
                            if($this.is(':visible')) {
                                $this.find('ul').show();
                            }
                        });
                    }
                    t = null;
                }, 300);
            }, function() {
                if (t) {
                    clearTimeout(t);
                    t = null;
                } else {
                    $this.find('ul').hide(0);
                    result.slideUp(333, function() { 
                        $this.find('ul').hide(0);
                    });
                }
            });
        });
    

    fiddle demo

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

Sidebar

Related Questions

I already managed to create function which checks if user is using a trial/demo
I managed to create the logic for the function but I have no idea
I managed to create a context menu that gets activated after a right click
I managed to create a query that fit my need. But now I am
I managed to create an application in Blackberry that plays audio file, but it
With help from @Joseph I have managed to create this script that works exactly
I am still very new to the MVC framework, but I managed to create
I am using JSF 2.0 Mojarra. I need to create a Managed Bean that
I've managed to create a a new user from a servlet using VMM. The
So I'm fairly new to jQueryMobile but I've managed to create a search bar

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.