首页 > 代码库 > Need a code of lazy load for div--reference

Need a code of lazy load for div--reference

1. For all DIVs of a page

$(function() {  $("div").lazyload({effect: ‘fadeIn‘});});

 

2. For a particular DIV having some ID like:

<div id="lazyload"> some content </div>

 

$(function() {  $("div#lazyload").lazyload({effect: ‘fadeIn‘});});

 

OR

 

$(function() {  $("#lazyload").lazyload({effect: ‘fadeIn‘});});

 

 

3. For a particular DIVs having some Class like:

<div class="lazyload"> some content </div>

 

$(function() {  $("div.lazyload").lazyload({effect: ‘fadeIn‘});});

 

OR

 

$(function() {  $(".lazyload").lazyload({effect: ‘fadeIn‘});});

 

4. These actions can also be performed on some trigger like Button Click, OnBlur etc

 

$(function() {

 

$("#button").click(function(){

   $(".lazyload").lazyload({effect: ‘fadeIn‘});

});  });

 

reference:http://www.bayt.com/en/specialties/q/33668/need-a-code-of-lazy-load-for-div/