My delay function is not working in my jquery rotate function. I am not sure why.
Basically, my code will make my div turn an angle and it will stop at a certain angle. This works at the moment. However i added a delay so it it will work after 3 or 4 seconds.
However its not doing it.
$(window).load(function() {
var $elie = $("#super");
rotate(1);
function rotate(degree) {
$elie.css({
'-webkit-transform': 'rotate(' + degree + 'deg)',
'-moz-transform': 'rotate(' + degree + 'deg)',
'-o-transform': 'rotate(' + degree + 'deg)',
'-ms-transform': 'rotate(' + degree + 'deg)',
'transform': 'rotate(' + degree + 'deg)'
});
console.log(degree);
if (degree < 55) {
timer = setTimeout(function() {
rotate(++degree)
}, 10)
delay: 4000;
}
}
});