嗨,我正在努力研究如何让星星的这些精灵动画在 Firefox 中正常工作,目前它似乎在 Chrome 和 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);
如果您想查看完整的源代码http://albertlegory.co.uk/comic.html,这是我正在尝试使用的页面的链接
因此,如果有人能够查看并让我知道我哪里出错了,将不胜感激。谢谢。