Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Saturday, December 17, 2011

Loading CDN hosted jQuery with local fallback

I found this piece of art in html5boilerplate.
It tries to load jQuery from a CDN and if it fails for whatever reason it tries a local one.

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)