I have a 6kb animated gif loading spinner. when I open it in a browser window, it spins fine. But when it opens on an ajax call on my web page, it is stuck. It appears ontime and disappears ontime, but does not spin.
Any ideas?
Here is the jQuery code:
$('#please-wait')
.css("visibility", "visible")//.hide()
.ajaxStart(function() {
$(this).css("visibility", "visible");
})
.ajaxStop(function() {
$(this).css("visibility", "hidden");
});
or
$('#please-wait')
.show()
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
any ideas?
Here is a jsfiddle example of how it should or could be done.
Here’s a snippet
If you’re doing the right parts of JQuery then the odds are your .gif doesn’t have a repeat cycle, meaning it only animates once. Since you only hide it instead of adding/removing, it doesn’t reset the animation.