Hi I'm struggling to work out how to get these sprite animations for the stars to work properly in Firefox, it currently seems to be working fine in Chrome and Safari.
var chips = true;
function star(item) {
$('.star').fadeIn();
var pos = ['0px 0','-35px 0','-70px 0','-105px 0','-140px 0', '-175px 0', '-210px 0', '-245px 0', '-280px 0', '-315px 0', '-350px 0', '-385px 0','-385px 0','-350px 0', '-315px 0','-280px 0','-245px 0','-210px 0', '-175px 0','-140px 0','-105px 0','-70px 0','-35px 0','0px 0' ];
var i = 0;
function animate() {
var a=0;
$(item).css('backgroundPosition',pos[i]);
if (i<24) {
i++;
}
else {
i=0;
}
a++
}
function fade() {
if (chips) {
$(item).fadeToggle(200);
chips = false;
}
else {
$(item).fadeIn(200);
chips=true;
}
}
setInterval(animate,55);
//setInterval(fade,200);
}
setTimeout (star('.star1'),20);
setTimeout (star('.star2'),20);
setTimeout (star('.star3'),20);
setTimeout (star('.star4'),20);
setTimeout (star('.star5'),20);
setTimeout (star('.star6'),20);
setTimeout (star('.star7'),20);
setTimeout (star('.star8'),20);
setTimeout (star('.star9'),20);
setTimeout (star('.star10'),20);
setTimeout (star('.star11'),20);
setTimeout (star('.star12'),20);
setTimeout (star('.star13'),20);
setTimeout (star('.star14'),20);
setTimeout (star('.star15'),20);
setTimeout (star('.star16'),20);
setTimeout (star('.star17'),20);
setTimeout (star('.star18'),20);
setTimeout (star('.star19'),20);
setTimeout (star('.star20'),20);
Here's a link to the page I'm trying to work with if you want to view the full source code http://albertlegory.co.uk/comic.html
So if anyone is able to have a look and let me know where I'm going wrong, it would be much appreciated. Thanks.