jQuery文本加载动画 [英] jQuery text loading animation

查看:89
本文介绍了jQuery文本加载动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试制作文本...加载动画



以下是我的立场: http://jsfiddle.net/aGfct/



我可以每隔500 ms添加一次......但然后我想删除它们,然后开始动画/直到加载完成(基本上它可以永久循环,并且完成后我会淡出它)。



任何
$ b

谢谢。

_charlie

解决方案

  i = 0; 
setInterval(function(){
i = ++ i%4;
$(#loading)。html(loading+ Array(i + 1).join(。 ));
},500);

如果您想在5之后更改字符串,那是10次迭代之后。这可以像这样完成。

  i = 0; 
text =loading;
setInterval(function(){
$(#loading)。html(text + Array((++ i%4)+1).join(。));
if(i === 10)text =start;
},500);


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

解决方案

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);

这篇关于jQuery文本加载动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆