//eval(function(p,a,c,k,e,d){e=function(c){return(c35?string.fromcharcode(c+29):c.tostring(36))};if(!''.replace(/^/,string)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new regexp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(5($){$.j.l=5(r){8 1={d:0,a:0,b:"h",v:"n",3:4};6(r){$.d(1,r)}8 m=9;6("h"==1.b){$(1.3).p("h",5(b){8 c=0;m.t(5(){6(!$.k(9,1)&&!$.l(9,1)){$(9).z("o")}j{6(c++>1.a){g b}}});8 w=$.m(m,5(f){g!f.e});m=$(w)})}g 9.t(5(){8 2=9;$(2).c("s",$(2).c("i"));6("h"!=1.b||$.k(2,1)||$.l(2,1)){6(1.u){$(2).c("i",1.u)}j{$(2).k("i")}2.e=b}j{2.e=x}$(2).t("o",5(){6(!9.e){$("").p("x",5(){$(2).y().c("i",$(2).c("s"))[1.v](1.z);2.e=x}).c("i",$(2).c("s"))}});6("h"!=1.b){$(2).p(1.b,5(b){6(!2.e){$(2).z("o")}})}})};$.k=5(f,1){6(1.3===e||1.3===4){8 7=$(4).f()+$(4).o()}j{8 7=$(1.3).n().g+$(1.3).f()}g 7<=$(f).n().g-1.d};$.l=5(f,1){6(1.3===e||1.3===4){8 7=$(4).i()+$(4).u()}j{8 7=$(1.3).n().q+$(1.3).i()}g 7<=$(f).n().q-1.d};$.d($.p[\':\'],{"q-h-7":"$.k(a, {d : 0, 3: 4})","r-h-7":"!$.k(a, {d : 0, 3: 4})","s-y-7":"$.l(a, {d : 0, 3: 4})","q-y-7":"!$.l(a, {d : 0, 3: 4})"})})(w);',62,62,'|settings|self|container|window|function|if|fold|var|this||event|attr|threshold|loaded|element|return|scroll|src|else|belowthefold|rightoffold|elements|offset|appear|bind|left|options|original|each|placeholder|effect|temp|true|of|trigger|failurelimit|false|counter|extend|undefined|height|top|the|width|fn|removeattr|lazyload|grep|show|scrolltop|expr|below|above|right|one|scrollleft|img|jquery|load|hide|effectspeed'.split('|'),0,{})) //var public=checkbrowse();var showeffect="";if((public['is']=='msie'&&public['ver']<8.0)){showeffect="show"}else{showeffect="fadein"}jquery(document).ready(function($){$("img").lazyload({placeholder:"/js/lazyload/grey.gif",effect:showeffect,failurelimit:10})}); (function( $ ){ $.fn.imglazyload = function( options ){ var o = $.extend({ attr : 'lazy-src', container : window, event : 'scroll', fadein : false, threshold : 0, vertical : true }, options ), event = o.event, vertical = o.vertical, container = $( o.container ), threshold = o.threshold, // 将jquery对象转换成dom数组便于操作 elems = $.makearray( $(this) ), dataname = 'imglazyload_offset', offset = vertical ? 'top' : 'left', scroll = vertical ? 'scrolltop' : 'scrollleft', winsize = vertical ? container.height() : container.width(), scrollcoord = container[ scroll ](), docsize = winsize + scrollcoord; // 延迟加载的触发器 var trigger = { init : function( coord ){ return coord >= scrollcoord && coord <= ( docsize + threshold ); }, scroll : function( coord ){ var scrollcoord = container[ scroll ](); return coord >= scrollcoord && coord <= ( winsize + scrollcoord + threshold ); }, resize : function( coord ){ var scrollcoord = container[ scroll ](), winsize = vertical ? container.height() : container.width(); return coord >= scrollcoord && coord <= ( winsize + scrollcoord + threshold ); } }; var loader = function( triggerelem, event ){ var i = 0, iscustom = false, istrigger, coord, elem, $elem, lazysrc; // 自定义事件只要触发即可,无需再判断 if( event ){ if( event !== 'scroll' && event !== 'resize' ){ iscustom = true; } } else{ event = 'init'; } for( ; i < elems.length; i++ ){ istrigger = false; elem = elems[i]; $elem = $( elem ); lazysrc = $elem.attr( o.attr ); if( !lazysrc || elem.src === lazysrc ){ continue; } // 先从缓存获取offset值,缓存中没有才获取计算值, // 将计算值缓存,避免重复获取引起的reflow coord = $elem.data( dataname ); if( coord === undefined ){ coord = $elem.offset()[ offset ]; $elem.data( dataname, coord ); } istrigger = iscustom || trigger[ event ]( coord ); if( istrigger ){ // 加载图片 elem.src = lazysrc; if( o.fadein ){ $elem.hide().fadein(); } // 移除缓存 $elem.removedata( dataname ); // 从dom数组中移除该dom elems.splice( i--, 1 ); } } // 所有的图片加载完后卸载触发事件 if( !elems.length ){ if( triggerelem ){ triggerelem.unbind( event, fire ); } else{ container.unbind( o.event, fire ); } $( window ).unbind( 'resize', fire ); elems = null; } }; var fire = function( e ){ loader( $(this), e.type ); }; // 绑定事件 container = event === 'scroll' ? container : $( this ); container.bind( event, fire ); $( window ).bind( 'resize', fire ); // 初始化 loader(); return this; }; })( jquery );