Trying to make a text ... loading animation
here's where I stand: http://jsfiddle.net/aGfct/
I can get the ... to be added at 500 ms intervals, but then I want to remove them and then start the animation over / until loading is done (basically it can loop forever, and I will fade it out when done).
Any help would be great.
Thanks.
_charlie
on({ ajaxStart: function() { $body. addClass("loading"); }, ajaxStop: function() { $body. removeClass("loading"); } }); That's it!
Using Code Step 1: Add loader DIV tag inside body tag. This DIV helps to display the message. Step 2: Add following CSS how it is going to displaying in browser. Step 3: Add following jQuery code when to fadeout loading image when page loads.
The jQuery animate() method is used to create custom animations. Syntax: $(selector). animate({params},speed,callback);
i = 0;
setInterval(function() {
i = ++i % 4;
$("#loading").html("loading"+Array(i+1).join("."));
}, 500);
If you wish to change the string after 5 says, that's after 10 iterations. This can be accomplished like this.
i = 0;
text = "loading";
setInterval(function() {
$("#loading").html(text+Array((++i % 4)+1).join("."));
if (i===10) text = "start";
}, 500);
http://jsfiddle.net/paska/aGfct/12/
var originalText = $("#loading").text(),
i = 0;
setInterval(function() {
$("#loading").append(".");
i++;
if(i == 4)
{
$("#loading").html(originalText);
i = 0;
}
}, 500);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With