0

I made this script that spins some sprockets I have on a page for a few rotations, then stops them waits a little bit and loops. It is timed with the sliding of a java slider so it makes the slider look like it's being driven by these sprockets, it's pretty cool. My problem is, it doesn't work in IE at all. Is there any way I could make this script work with 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;

}
});

0 Answers0