Fade in delay on Load

走远了吗. 提交于 2019-12-05 18:21:05

If you had divs, say class="faded", you could fade each in on load, each in a row like this:

$(".faded").each(function(i) {
  $(this).delay(i * 400).fadeIn();
});

You can view a demo of this effect here, or a slower version here. The 400 is for 400ms, the duration of the normal .fadeIn() speed :)

You can either use .hide() to hide them on page load, like this:

$(".faded").hide()

Or do it in the CSS:

.faded { display: none; }

You could have the fadeIn on element2 begin at the completion callback time of element1:

 element1.fadeIn(500, function() {  
       element2.fadeIn(500, function() { 
            etc...

Since I don't believe that these types of animation have anything in the way of a success callback, if you know how long an element will take to fade, you can use something like setTimeout() to fire off the next after the proper amount of time has passed.

Edit: I stand corrected.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!