Fade elements in incrementally on window load

送分小仙女□ 提交于 2019-11-30 10:32:35

This fades all divs into view, each with a progessing 250ms delay. I'd recommend reducing the fade time to 2 seconds for each at max, 4 seconds seems waaay too long and will probably annoy people ;-)

$(window).load(function() {
   $('div').each(function(i) {
      $(this).delay((i + 1) * 250).fadeIn(2000);
   });
});

You can iterate through them and set a delay before the fadeIn():

$(window).load(function(){
   var delay = 0;
   $('div.fade_this_please').each(function(){
      $(this).delay(delay).fadeIn(4000);
      delay += 250;
   });
});

try with

$('div.fade_this_please').fadeIn(4000).delay(250);

or

jQuery(function($){
var e = $('div.fade_this_please'); 
e.fadeIn(); 
e.queue(function(){ 
  setTimeout(function(){ 
    e.dequeue(); 
  }, 250 ); 
}); 
});

reference

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