Make your blog faster with lazy Image loading script

website-speed-optimize-1
Don’t you hate it when websites load slowly? I know I do. And to make matters worse, do you even come back to websites that load slow? The chances are, you don’t!.There are many factors But Images are one of the important factor that affects blog load time.So,To reduce blog Images load time today I have brought lazy image loading plugin for blogger!

Lazy Load is a jQuery plugin which only loads Images seeable in the viewport (visible part of web page) thereby enhancing the Page Load time. The images which are out the initial visible region of the screen are loaded as the users scrolls through them. A really useful plugin for Image intensive Blog's.This widget really decrease the 50% of blogs load time as you check your own blog with Gtmetrics.Lets see the working of this plugin

How to install this plugin to blogger?

  • Login to Blogger > Dashboard
  • Click on Drop Down Menu and select Template
  • Backup your Template before making any changes to your blog
  • Now Click on Edit HTML > Proceed
  • Press Ctrl + F and search the code shown below. 
</head>
Copy below codes and paste above </head>

<script type='text/javascript'>//<![CDATA[
(function(a){a.fn.lazyload=function(b){var c={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(b){a.extend(c,b)}var d=this;if("scroll"==c.event){a(c.container).bind("scroll",function(b){var e=0;d.each(function(){if(a.abovethetop(this,c)||a.leftofbegin(this,c)){}else if(!a.belowthefold(this,c)&&!a.rightoffold(this,c)){a(this).trigger("appear")}else{if(e++>c.failurelimit){return false}}});var f=a.grep(d,function(a){return!a.loaded});d=a(f)})}this.each(function(){var b=this;if(undefined==a(b).attr("original")){a(b).attr("original",a(b).attr("src"))}if("scroll"!=c.event||undefined==a(b).attr("src")||c.placeholder==a(b).attr("src")||a.abovethetop(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.rightoffold(b,c)){if(c.placeholder){a(b).attr("src",c.placeholder)}else{a(b).removeAttr("src")}b.loaded=false}else{b.loaded=true}a(b).one("appear",function(){if(!this.loaded){a("<img />").bind("load",function(){a(b).hide().attr("src",a(b).attr("original"))[c.effect](c.effectspeed);b.loaded=true}).attr("src",a(b).attr("original"))}});if("scroll"!=c.event){a(b).bind(c.event,function(c){if(!b.loaded){a(b).trigger("appear")}})}});a(c.container).trigger(c.event);return this};a.belowthefold=function(b,c){if(c.container===undefined||c.container===window){var d=a(window).height()+a(window).scrollTop()}else{var d=a(c.container).offset().top+a(c.container).height()}return d<=a(b).offset().top-c.threshold};a.rightoffold=function(b,c){if(c.container===undefined||c.container===window){var d=a(window).width()+a(window).scrollLeft()}else{var d=a(c.container).offset().left+a(c.container).width()}return d<=a(b).offset().left-c.threshold};a.abovethetop=function(b,c){if(c.container===undefined||c.container===window){var d=a(window).scrollTop()}else{var d=a(c.container).offset().top}return d>=a(b).offset().top+c.threshold+a(b).height()};a.leftofbegin=function(b,c){if(c.container===undefined||c.container===window){var d=a(window).scrollLeft()}else{var d=a(c.container).offset().left}return d>=a(b).offset().left+c.threshold+a(b).width()};a.extend(a.expr[":"],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery);$(function(){$("img").lazyload({placeholder:"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib783M6_WT3G8VgJZPdAAYSsAVq7zC13iCYKZl8Mn1JyGApb3CY8-2D_k3k-cMZFoBULrFxfIMZjotA57B_wP_Hzr5tbMWW-tY_si7_t1CxSDkUJDqnj_3A3u4yHRiYz9dVqHofScKQ30/s1600/truebloggertricks.blogspot.com.gif",effect:"fadeIn",threshold:"-50"})})//]]></script>

  • Now just press on save template and refresh your blog.  
  • Now just scroll your blog and see your images fade in with lazy loading effect.
If you have any Doubts regarding this post, Please ask it via comments and Dont forget to share this post with your friends!!

38 comments:

  1. blogger_logo_round_35

    Really Nice Trick.
    http://www.blogiri.com/

    ReplyDelete
  2. blank

    you have great work but some widget of your blog is similar to my blog

    look like my blogger widgets

    ReplyDelete
  3. blogger_logo_round_35

    I added this code to my blog Free Android App Shop.com... But after placing this code my adsense ads not showing up.. So I just removed this code from my template.. please fix..

    ReplyDelete
    Replies
    1. blogger_logo_round_35

      I think This script unsupports Adsense banners so,It is better to remove this script from your blog.

      I will try to find the solution soon and fix it:)

      Delete
    2. blogger_logo_round_35
  4. blank

    Some Error in this Code Try To FiX it. There is symbol error . Fix and Tell me
    http://www.scriptjabbers.com/

    ReplyDelete
  5. blogger_logo_round_35

    Durai bro, I have sent you a guest mail on your email id. Kindly check it and let me know. :)

    ReplyDelete
  6. blank

    Thank you rely done Great, It work Like charm

    ReplyDelete
  7. blogger_logo_round_35

    i used this code in my template but not running. how to fix it. please help me. thanks a lot

    ReplyDelete
    Replies
    1. blogger_logo_round_35

      Can you please tell me your blog url?

      Delete
    2. blogger_logo_round_35

      http://blogonol.blogspot.com/
      thanks before for your help. happy blogging

      Delete
  8. blogger_logo_round_35
  9. blogger_logo_round_35

    thanks a lot. this is run 100% in my blog.

    ReplyDelete
  10. blank

    Thanks for saving live, it work like charm

    ReplyDelete
  11. blank
  12. blank

    nice one visit www.allworld.co.nr

    ReplyDelete
  13. blank

    Thank you very much. It helped me alot.
    http://reviews-articles-blogs.blogspot.in/

    ReplyDelete
  14. blogger_logo_round_35
  15. blogger_logo_round_35
  16. blogger_logo_round_35

    This comment has been removed by the author.

    ReplyDelete
  17. blogger_logo_round_35

    Working, superb, but i have a question, this script opens images in the lower part of blog only when the user scrolls down is this right? I have ads on the lower part of my blog also, so suppose if the user doesnt scroll down then those ads wont open? because i get paid CPM so i dont want to loos out on that. is this correct or i am missing something, Plz reply... thanks.

    http://ultimatesqs.blogspot.in

    ReplyDelete
  18. hmbucket_gangway
  19. 12347615_1080795491954234_7206347335290766312_n

    Very nice Tricks
    http://moonblogger4u.blogspot.com/

    ReplyDelete
  20. blank

    Nice Trick!
    http://lwthacking.blogspot.com/

    ReplyDelete
  21. blogger_logo_round_35
  22. blogger_logo_round_35
  23. blogger_logo_round_35

    http://www.bedoitechsolutions.com/

    ReplyDelete
  24. blank

    Added this to our list of valuable conversion resources. Will look forward to trying some of these experiments/tricks on our site! Thanks for sharing !

    ReplyDelete
  25. blank

    are you sure this code can make loading very fast????

    ReplyDelete
  26. blogger_logo_round_35

    Hey Friend can you tell me di-marits of this Script if any. Other wise Nise Post.
    One more thing I am not able to denoted the speed of site is increase, its really increase or not :)
    Blog of Blogger.com

    ReplyDelete
  27. blogger_logo_round_35

    dear admin this article is very useful for me thank you lot,amazingly best blogger tutorials

    ReplyDelete
    Replies
    1. blogger_logo_round_35

      but one thing just i cant understood without trying your message those people or bloggers asking you, really is it work or not? this is not good respect for a blogger guide (admin)

      Delete
  28. blogger_logo_round_35

    i want to lear more about bloggs, just now i have involved blogging.really i dont knew even what is a blogg?the word i knew just five or six month back,i am a professional pharmacist practising in my own drug store so i want say something about medicament and first aid ,diseases and so on
    please give some thing about prof blogging thank you admin please rpl me.

    ReplyDelete
  29. blogger_logo_round_35

    Nice one! Is is safe for SEO?

    My blog : http://funwithtricks.com

    ReplyDelete
  30. blogger_logo_round_35

    Really a nice article. I bookmark it. Keep it up.Visit also to my site to get more tips on how to fast your site.

    ReplyDelete
  31. blogger_logo_round_35

    it's work...nice post...

    visit back...http://bukawww.blogspot.com/

    ReplyDelete

Please don't spam. We hate spammers