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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:35:57+00:00 2026-05-27T04:35:57+00:00

I have a panel who slide automatically after 13 seconds. I made this with

  • 0

I have a panel who slide automatically after 13 seconds. I made this with jquery.delay().
The problem appears if I want to manually slide the panel with a click event. It appears that the click event is waiting the end of the delay to effect..

What can I use in place of delay()?

My code :

The delay part:

$('#menu').delay(13000).hide("slide", { direction: "right" }, 400, function () {
            if ($('#menu').is(':hidden')) {
                $('#trigger').removeClass("triggerdroiteExtended");
                $('#trigger').addClass("triggerdroiteCollapsed");
                $.cookie('rightfold', 'collapsed', { path: '/' });
            }
        });

The Click event part:

  $('#triggerdroite').click(function () { foo
});
  • 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-27T04:35:57+00:00Added an answer on May 27, 2026 at 4:35 am

    This is a place you’re probably better off using setTimeout and clearTimeout. From the delay docs:

    The .delay() method is best for delaying between queued jQuery effects. Because it is limited — it doesn’t, for example, offer a way to cancel the delay — .delay() is not a replacement for JavaScript’s native setTimeout function, which may be more appropriate for certain use cases.

    (My emphasis.)

    So in this case:

    (function() {
        var slideTimer = 0;
        slideTimer = setTimeout(function() {
            $('#menu').hide("slide", { direction: "right" }, 400, function () {
                    if ($('#menu').is(':hidden')) {
                        $('#trigger').removeClass("triggerdroiteExtended");
                        $('#trigger').addClass("triggerdroiteCollapsed");
                        $.cookie('rightfold', 'collapsed', { path: '/' });
                    }
                });
        }, 13000);
        $('#triggerdroite').click(function() {
            if (slideTimer) {
                clearTimeout(slideTimer);
                slideTimer = 0;
            }
    
            // ...
        });
    })();
    

    (The outer anonymous function is just a placeholder, I assume your code is already inside some function to prevent creating globals.)

    Note I’m using 0 as a “no timer running” value. 0 is not a valid return value from setTimeout, so it’s a useful flag.

    Of course, rather than storing this in a variable as I have above, you could always store it on the #menu element itself using data.

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

Sidebar

Related Questions

I have panel that is using group layout to organize some label. I want
I have a panel on an aspx page which contains an UpdatePanel. This panel
I have a Panel and I am adding controls inside this panel. But there
This question will seem obvious to those who haven't encountered the problem themselves. I
In my form panel, i have some fields who are required . I explain
I have a Website something like twitter who are update per 30 seconds or
First off thanks to all the users who have made my android developing adventure
I have an Panel control that I need to maintain position across postbacks. I
I have a panel that draws alot of things. To make drawing effecient I
i have a panel (A), which contains 3 other panels (AA, AB, AC). Each

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.