Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to twinkle shadow using jQuery?

I am a newbie and I was trying to figure out on how to twinkle box-shadow on an element but I couldn't.

So far I got this.

Theoretically, it's supposed to work. I used setInterval inside for loop but it didn't work. Also, I think I got some issues with toggle function.

The main point is that when page starts loading I want that element's box-shadow to start twinkling from very fast to very slow and eventually it would stop.

Do you have any suggestions?!

like image 699
FoxKllD Avatar asked Jul 06 '26 22:07

FoxKllD


1 Answers

I agree with Praveen Vijayan. Here is a showcase with css3 key-frames: http://jsfiddle.net/ufP7h/

@-webkit-keyframes twinkly {
    0%   { box-shadow: 0 0 10px #6c9; }
    100% { box-shadow: 0 0 10px red; }
}
@-moz-keyframes twinkly  {
     0%   { box-shadow: 0 0 10px #6c9; }
    100% { box-shadow: 0 0 10px red; }
}
@-ms-keyframes twinkly  {
     0%   { box-shadow: 0 0 10px #6c9; }
    100% { box-shadow: 0 0 10px red; }
}

#twinkle {
    -webkit-animation: twinkly 1s alternate infinite;
    -moz-animation: twinkly 1s alternate infinite;
    -ms-animation: twinkly 1s alternate infinite;
}

like image 93
Bram Vanroy Avatar answered Jul 08 '26 23:07

Bram Vanroy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!