Reputation: 46
This is what ive tried so far. Im not getting an error in the console and the div isn't rotating either http://jsfiddle.net/B8shT/
window.i = 10000;
function dothetwist()
{
$('#box').animate( {
step: function(now,fx) {
$(this).css('-webkit-transform','rotatey('+now+'deg)');
},
duration: window.i,
complete: function() {
window.i=window.i-1000;
dothetwist();
}
});
}
What am i doing wrong?
Upvotes: 0
Views: 159
Reputation: 570
I guess this is what you need. JSFIDDLE
window.i = 10000;
function dothetwist() {
$( "#box" ).animate({
rotate: 1000
}, {
step: function(now,fx) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
},
duration: window.i,
complete: function() {
window.i=window.i-1000;
dothetwist();
}
});
}
$("#box").click(function() {
dothetwist();
});
P.S.: You can control the speed of rotation by changing "rotate: 1000" property to any other value.
Thanks @nnnnnn for getting me started.
Upvotes: 1