我创建了这个脚本,它在页面上旋转一些链轮进行几次旋转,然后停止它们等待一会儿循环。它是滑动java滑块的时间,所以它使滑块看起来像是由这些链轮驱动,它非常酷。我的问题是,它根本不适用于IE。有什么方法可以让这个脚本与IE9一起使用吗?
google.load("jquery", "1.3.1");
google.setOnLoadCallback(function()
{
timeout = setTimeout(function() {
var interval = 5100;
var looping = setInterval(startAni, interval);
startAni();
}, 4300);
/** spins clock wise **/
function startAni() {
$(".sprocketcw").each(function() {
$(this)
.css({ 'cursor' : 'move' })
.data('rotationAngle', 2);
startSpinning($(this));
function startSpinning(element) {
element.stop().animate({rotate: '+=10deg'}, 800, 'easeInCubic', function() {
var intervalHandle = setInterval(
function () {
element.animate({rotate: '+=' + element.data('rotationAngle') + 'deg'}, 0);
},
25
);
element.data('intervalHandle', intervalHandle);
//clears interval to stop
timeout = setTimeout(function () {
clearInterval(intervalHandle);
}, 2000);
});
}
});
/** spins counter clock wise **/
$(".sprocketcc").each(function() {
$(this)
.css({ 'cursor' : 'move' })
.data('rotationAngle', -2);
startSpinning($(this));
function startSpinning(element) {
element.stop().animate({rotate: '-=10deg'}, 800, 'easeInCubic', function() {
var intervalHandle = setInterval(
function () {
element.animate({rotate: '+=' + element.data('rotationAngle') + 'deg'}, 0);
},
25
);
element.data('intervalHandle', intervalHandle);
//clears interval to stop
timeout = setTimeout(function () {
clearInterval(intervalHandle);
}, 2000);
});
}
});
// Variable to store if the sprockets are spinning
var playing = false;
}
});