Add Lazy Loading Images In Blogger
Lazy Loading Images |
Defer Offscreen Images Problem Can Be Solved By Adding Lazy Loading Images In Blogger And HTML Page.
Table Of Contents
How Page Speed Affects Ranking?
Benefits Of Adding Lazy Loading Images?
[SOLVED] Defer Offscreen Images Problem In GTmetrix
<script type='text/javascript'>
//<![CDATA[
const _0xce27=['forEach','querySelectorAll','IntersectionObserver','target','remove','DOMContentLoaded','observe','slice','dataset','unobserve','src','call'];(function(_0x45695d,_0xce273f){const _0x2d1373=function(_0x5639fc){while(--_0x5639fc){_0x45695d['push'](_0x45695d['shift']());}};_0x2d1373(++_0xce273f);}(_0xce27,0x187));const _0x2d13=function(_0x45695d,_0xce273f){_0x45695d=_0x45695d-0x0;let _0x2d1373=_0xce27[_0x45695d];return _0x2d1373;};document['addEventListener'](_0x2d13('0xa'),function(){var _0x4fa9ec=[][_0x2d13('0x0')][_0x2d13('0x4')](document[_0x2d13('0x6')]('img.lazy'));if(_0x2d13('0x7')in window){let _0x4c83f3=new IntersectionObserver(function(_0x3ad8d9,_0x2f0c28){_0x3ad8d9[_0x2d13('0x5')](function(_0x1ef53b){if(_0x1ef53b['isIntersecting']){let _0x85cc0b=_0x1ef53b[_0x2d13('0x8')];_0x85cc0b[_0x2d13('0x3')]=_0x85cc0b[_0x2d13('0x1')][_0x2d13('0x3')],_0x85cc0b['classList'][_0x2d13('0x9')]('lazy'),_0x4c83f3[_0x2d13('0x2')](_0x85cc0b);}});});_0x4fa9ec[_0x2d13('0x5')](function(_0x2e1205){_0x4c83f3[_0x2d13('0xb')](_0x2e1205);});}});
//]]>
</script>
Copy The Above Script, Paste It In A HTML Gadget Or Paste It Above </body> Tag. Make Sure You Add class="lazy" To Each Image Tags And Change "scr" To "data-scr". Watch The Youtube Video At The End Of This Post For Better Understanding.
[PROOF] Lazy Loading Images
1] In The Below Image, You Can See Only One Image Is Loaded i.e Image Below Default.jpg.
2] When I Further Scroll Down The Second Image Got Loaded.
3] At Last, The Third Image Got Loaded. You Can See The Waterfall For More Clarity.
But the first post image also loads only after scroll is activated. Can the first image load and then other images as scrolled down
ReplyDeleteI Hope You Have Already Implemented The Script In Blogger, But Don't Lazy Load The First Image Of Your Blog As It Causes Thumbnail Problem On The Home Page. You Can Lazy Load All The Remaining Images By Appending Class=lazy And Changing src To data-src
DeleteThank You!!!
Hello,
ReplyDeleteI have a question, please.
Do I have to search for all links that start with <img inside my template to add loading="lazy" or this action belongs to new and old static pages and blog posts that they have images?
Regards,
Osama
Depends On You.
DeleteAfter Including The Script In The Template. Just Add Class="lazy" For The Images That You Want To Lazy Load i.e Will Load After The User Reaches Viewport.
You Can Lazy Load Images You Want By Appending Lazy Class.
Thank you bro, very useful
ReplyDeleteWelcome! 😊
Delete