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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:13:53+00:00 2026-05-30T18:13:53+00:00

This does do the delays but doesn’t seem to apply the style changes until

  • 0

This does do the delays but doesn’t seem to apply the style changes until the end:

for (i=20;i>=0;i--) {            
    var boxShadow = i+"px "+i+"px "+i+"px #888";
    $('article').css("box-shadow", boxShadow);
    sleep(20);
}
function sleep(ms)
{
    var dt = new Date();
    dt.setTime(dt.getTime() + ms);
    while (new Date().getTime() < dt.getTime());
}

This doesn’t apply the delays at all:

for (i=20;i>=0;i--) {            
    var boxShadow = i+"px "+i+"px "+i+"px #888";
    $('article').delay(500).css("box-shadow", boxShadow);
}

Can this be done more easily with css3 transitions? Am I just making some small jquery error in the delay sample?

Thank you to anyone who can help.

  • 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-30T18:13:54+00:00Added an answer on May 30, 2026 at 6:13 pm

    You can use classes and setTimeout to utilize CSS3 transitions for your animation effect:

    CSS —

    #some-element {
        -webkit-transition : all 0.5s linear;
           -moz-transition : all 0.5s linear;
            -ms-transition : all 0.5s linear;
             -o-transition : all 0.5s linear;
                transition : all 0.5s linear;
    }
    #some-element.ani-state {
        -webkit-box-shadow : 0 0 24px #000;
           -moz-box-shadow : 0 0 24px #000;
                box-shadow : 0 0 24px #000;
    }
    

    I used all for the transition declarations because of Chrome… some versions of Chrome use -webkit-box-shadow and newer versions use box-shadow. all isn’t a big deal if you aren’t changing any other properties of the element (or if you want to animate those property changes).

    JS —

    $(function () {
    
        var $someElement = $('#some-element');
    
        $someElement.on('click', function () {
            $someElement.addClass('ani-state');
            setTimeout(function () {
                $someElement.removeClass('ani-state');
            }, 500);
        });
    });
    

    Here is a demo: http://jsfiddle.net/jasper/tvfPq/1/

    Note that in the demo I used two box-shadows: box-shadow : 0 0 24px #000, inset 0 0 24px #999;

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

Sidebar

Related Questions

This does not really apply to any language specifically, but if it matters I
This may seem a silly question, but having been pondering it for a few
Why does this empty the text immediately (ignoring delay)? $('#error_box_text').html('error text').delay(5000).html('') # jQuery 1.4
Why this delay of Jquery animation does not work as it should be? $(
This does NOT work: Sub X() Dim A As Access.Application Set A = CreateObject(Access.Application)
Update: This does work, I was being stupid :( i have the following extension
Googling this does little good, as you can imagine. Does anyone have resources that
Ops: This does not belong to ServerFault because it focuses on Programing Architecture. I
anyone knows why this does not work when I try to include a library
Basically what this does is fadeIn pre-existing divs and then loads an image. When

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.