Created
October 11, 2019 03:25
-
-
Save Nilpo/295a0e7b91ca710e205a7f8c04ac115c to your computer and use it in GitHub Desktop.
Animating Favicons with jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var favicon_images = [ | |
'http://website.com/img/tmp-0.gif', | |
'http://website.com/img/tmp-1.gif', | |
'http://website.com/img/tmp-2.gif', | |
'http://website.com/img/tmp-3.gif', | |
'http://website.com/img/tmp-4.gif', | |
'http://website.com/img/tmp-5.gif', | |
'http://website.com/img/tmp-6.gif' | |
], | |
image_counter = 0; // To keep track of the current image | |
setInterval(function() { | |
$("link[rel='icon']").remove(); | |
$("link[rel='shortcut icon']").remove(); | |
$("head").append('<link rel="icon" href="' + favicon_images[image_counter] + '" type="image/gif">'); | |
// If last image then goto first image | |
// Else go to next image | |
if(image_counter == favicon_images.length -1) | |
image_counter = 0; | |
else | |
image_counter++; | |
}, 200); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to break them up to images?