0

我制作了这个脚本,它使我在页面上的一些链轮旋转了几圈,然后停止它们等待一点并循环。它与 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;

}
});
4

0 回答 0