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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:44:44+00:00 2026-05-31T10:44:44+00:00

The delay function isn’t working as I expect it should. I’m sure I’m doing

  • 0

The delay function isn’t working as I expect it should. I’m sure I’m doing something wrong. I have an overlay that I want to use. When a user clicks a link, I’d like this function to delay for 1 second and then “release”, allowing the user to go to the link they clicked on. How can I do this?

     $("body").append("<div id='overlay'></div>");
     $("#overlay").height(docHeight).css({
...
      }).delay(1000);  <-- This is where I think it should go...
    });

EDIT:

I’ve tried both solutions offered but I can’t get the overlay to hold. The screen just refreshes in about half a second. It’s ignoring the setTimeout function. What I did to test the setTimeout function was the following but I don’t even get the alert. I’m assuming that I would put my overlay code in place of where I have the alert(), right?

Just for clarity, what I expect to see is a 1 second delay when the .load selector is clicked then the user forwarded to the link they clicked.

  $('.load').click(function() {
    setTimeout(function(){
      alert();
    }, 1000);
  });
  • 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-31T10:44:45+00:00Added an answer on May 31, 2026 at 10:44 am

    How .delay() works

    From the documentation:

    .delay() – Set a timer to delay execution of subsequent items in the queue.

    And example usage:

    $("div.first").slideUp(300).delay(800).fadeIn(400);
    

    Solution

    If you want however to delay execution of some command and it is not in the queue like the above, then just use simple JavaScript’s setTimeout():

    setTimeout(function(){
        $("#overlay").height(docHeight).css({
            ...
        });
    }, 1000);
    

    In your case this is the preferred solution, as delay() works only on queued items (as mentioned above). As a proof see that this is not working: http://jsfiddle.net/xaC3m/

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

Sidebar

Related Questions

I have a div that is above something I want to showcase, and I
I need to put a one second delay in this jQuery function so that
I am expecting when I go $.each($(something).find(something), function(){ $(this).delay(1000).fadeOut(); }); then for each matching
How can I delay actions between keypress in jQuery. For example; I have something
I have this function that puts some data with Ajax call in a php
Not sure why this isn't working. When people click the 'edit' button of my
I have a gif animation that will loop forever. However, I don't want it
I have values in my function but it says it isn't defined. This is
In traditional embedded programming, we will give a delay function like so: for(i=0;i<255;i++) for(j=0;j<255;j++);
As every Haxe developer knows, you could use haxe.Timer.delayed() to delay function call for

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.