首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >烟雾脚本时间

烟雾脚本时间
EN

Stack Overflow用户
提问于 2014-05-02 09:08:00
回答 1查看 488关注 0票数 0

我在我的网站上使用以下脚本:

http://demo.web3designs.com/css-jquery-animated-hot-smoke-coffee-tea-effect.htm

我如何编辑它,使烟雾不是连续的,而是每20秒出现一次?

以下是javascript:

代码语言:javascript
复制
if(!$.browser.msie){
        var a=0;for(;a<15;a+=1){setTimeout(function b(){var a=Math.random()*1e3+5e3,c=$("<div />",{"class":"smoke",css:{opacity:0,left:Math.random()*200+80}});$(c).appendTo("#viewport");$.when($(c).animate({opacity:1},{duration:a/4,easing:"linear",queue:false,complete:function(){$(c).animate({opacity:0},{duration:a/3,easing:"linear",queue:false})}}),$(c).animate({bottom:$("#viewport").height()},{duration:a,easing:"linear",queue:false})).then(function(){$(c).remove();b()})},Math.random()*3e3)}
    }else{      
    "use strict";var a=0;for(;a<15;a+=1){setTimeout(function b(){var a=Math.random()*1e3+5e3,c=$("<div />",{"class":"smoke",css:{left:Math.random()*200+80}});$(c).appendTo("#viewport");$.when($(c).animate({},{duration:a/4,easing:"linear",queue:false,complete:function(){$(c).animate({},{duration:a/3,easing:"linear",queue:false})}}),$(c).animate({bottom:$("#viewport").height()},{duration:a,easing:"linear",queue:false})).then(function(){$(c).remove();b()})},Math.random()*3e3)}}}())
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-02 09:10:33

我认为$.timer()是你要找的东西。

http://code.google.com/p/jquery-timer/

代码语言:javascript
复制
var timer = $.timer(function() {
    // Place your code here;
});

timer.set({ time : 20000, autostart : true });
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23424534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档