Searching...
Sunday, 7 April 2013

Speedup your Blogger Blog with Image Lazy Loading Script

Speedup your Blogger Blog with Image Lazy Loading Script
Speeds play a really important role in overall website performance and traffic results, faster the website more traffic can be circulated hence page views will also get a boost. Lazy loading script for blogger simply makes your images to load when a person scrolls to them hence saving bandwidth and http requests for that time. So if you are interested follow the below tutorial and get some speeds up.

1. Go to
 Blogger > Template > Edit HTML.
2. Press Ctrl + F and search for  tag and paste below code above it.

<script type='text/javascript'>//<![CDATA[ undefinedfunctionundefineda){a.fn.lazyload=functionundefinedb){var c={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};ifundefinedb){a.extendundefinedc,b)}var d=this;ifundefined"scroll"==c.event){aundefinedc.container).bindundefined"scroll",functionundefinedb){var e=0;d.eachundefinedfunctionundefined){ifundefineda.abovethetopundefinedthis,c)||a.leftofbeginundefinedthis,c)){}else ifundefined!a.belowthefoldundefinedthis,c)&&!a.rightoffoldundefinedthis,c)){aundefinedthis).triggerundefined"appear")}else{ifundefinede++>c.failurelimit){return false}}});var f=a.grepundefinedd,functionundefineda){return!a.loaded});d=aundefinedf)})}this.eachundefinedfunctionundefined){var b=this;ifundefinedundefined==aundefinedb).attrundefined"original")){aundefinedb).attrundefined"original",aundefinedb).attrundefined"src"))}ifundefined"scroll"!=c.event||undefined==aundefinedb).attrundefined"src")||c.placeholder==aundefinedb).attrundefined"src")||a.abovethetopundefinedb,c)||a.leftofbeginundefinedb,c)||a.belowthefoldundefinedb,c)||a.rightoffoldundefinedb,c)){ifundefinedc.placeholder){aundefinedb).attrundefined"src",c.placeholder)}else{aundefinedb).removeAttrundefined"src")}b.loaded=false}else{b.loaded=true}aundefinedb).oneundefined"appear",functionundefined){ifundefined!this.loaded){aundefined"<img />").bindundefined"load",functionundefined){aundefinedb).hideundefined).attrundefined"src",aundefinedb).attrundefined"original"))[c.effect]undefinedc.effectspeed);b.loaded=true}).attrundefined"src",aundefinedb).attrundefined"original"))}});ifundefined"scroll"!=c.event){aundefinedb).bindundefinedc.event,functionundefinedc){ifundefined!b.loaded){aundefinedb).triggerundefined"appear")}})}});aundefinedc.container).triggerundefinedc.event);return this};a.belowthefold=functionundefinedb,c){ifundefinedc.container===undefined||c.container===window){var d=aundefinedwindow).heightundefined)+aundefinedwindow).scrollTopundefined)}else{var d=aundefinedc.container).offsetundefined).top+aundefinedc.container).heightundefined)}return d<=aundefinedb).offsetundefined).top-c.threshold};a.rightoffold=functionundefinedb,c){ifundefinedc.container===undefined||c.container===window){var d=aundefinedwindow).widthundefined)+aundefinedwindow).scrollLeftundefined)}else{var d=aundefinedc.container).offsetundefined).left+aundefinedc.container).widthundefined)}return d<=aundefinedb).offsetundefined).left-c.threshold};a.abovethetop=functionundefinedb,c){ifundefinedc.container===undefined||c.container===window){var d=aundefinedwindow).scrollTopundefined)}else{var d=aundefinedc.container).offsetundefined).top}return d>=aundefinedb).offsetundefined).top+c.threshold+aundefinedb).heightundefined)};a.leftofbegin=functionundefinedb,c){ifundefinedc.container===undefined||c.container===window){var d=aundefinedwindow).scrollLeftundefined)}else{var d=aundefinedc.container).offsetundefined).left}return d>=aundefinedb).offsetundefined).left+c.threshold+aundefinedb).widthundefined)};a.extendundefineda.expr[":"],{"below-the-fold":"$.belowthefoldundefineda, {threshold : 0, container: window})","above-the-fold":"!$.belowthefoldundefineda, {threshold : 0, container: window})","right-of-fold":"$.rightoffoldundefineda, {threshold : 0, container: window})","left-of-fold":"!$.rightoffoldundefineda, {threshold : 0, container: window})"})})undefinedjQuery);$undefinedfunctionundefined){$undefined"img").lazyloadundefined{placeholder:"http://i22.servimg.com/u/f22/15/42/72/40/grey10.gif",effect:"fadeIn",threshold:"-50"})})//]]></script>
3. Now just press on save template and refresh your blog.
4. Now just scroll your blog and see your images fade in with lazy loading effect.

0 comments:

Post a Comment