Monday, November 29, 2010

Infinite blinking effect with jQuery

I'm not sure this is the shortest way to do this but it works.

setInterval( function () {

// this is the element you want to blink
var box = $(".blinking_thing");

if (box.data("fade") === 1) {
box.fadeIn().data("fade", 2);
} else {
box.fadeOut().data("fade", 1);
}
}, 800)

No comments:

Post a Comment