js延迟执行代码的方法

1,第一种

Window setTimeout() 方法

3 秒(3000 毫秒)后弹出 "Hello" :

setTimeout(function(){ alert("Hello"); }, 3000);

点击打开链接

2,第二种

jQuery delay() 方法

$("button").click(function(){
  $("#div1").delay("slow").fadeIn();
  $("#div2").delay("fast").fadeIn();
});

点击打开链接

posted @ 2020-05-09 15:28  八戒vs  阅读(6392)  评论(0)    收藏  举报