Download lazyload js from below link
http://www.appelsiini.net/projects/lazyload
And save in js/lazyload/jquery.lazyload.js
Then create lazyload.phtml in template/lazyload/lazyload.phtml with following code
<script type="text/javascript" charset="utf-8">
jQuery("img").load(function(){if(jQuery(this).attr("src")!=="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>blank.png"){jQuery(this).removeAttr("height")}});
jQuery(function() {
jQuery("img").lazyload({
effect : "fadeIn",
});
});
</script>
And add following code in catalog.xml
<reference name="head">
<action method="addJs"><script>jquery.lazyload.min.js"></script></action>
</reference>
<reference name="after_body_start">
<block type="core/template" template="lazyloader/lazyload.phtml" name="lazyloader_init" />
</reference>
Remember that jquery must be included in site.
http://www.appelsiini.net/projects/lazyload
And save in js/lazyload/jquery.lazyload.js
Then create lazyload.phtml in template/lazyload/lazyload.phtml with following code
<script type="text/javascript" charset="utf-8">
jQuery("img").load(function(){if(jQuery(this).attr("src")!=="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>blank.png"){jQuery(this).removeAttr("height")}});
jQuery(function() {
jQuery("img").lazyload({
effect : "fadeIn",
});
});
</script>
And add following code in catalog.xml
<reference name="head">
<action method="addJs"><script>jquery.lazyload.min.js"></script></action>
</reference>
<reference name="after_body_start">
<block type="core/template" template="lazyloader/lazyload.phtml" name="lazyloader_init" />
</reference>
Remember that jquery must be included in site.
Hello i just discovered your blog and i love your work. i have a problem. i installed the mgt-commerce lazy loader extension but i cannot find the exact code i am supposed to replace in my list.phtml file.
ReplyDeletewhat do i do
Here is also a Lazy Image Loader to help Magento sites perform better. Images are only loaded when customers scroll down the page
ReplyDeletehttp://bsscommerce.com/magento-lazy-image-loader.html
For anyone who needs Lazy Load extension for Magento 2: https://goo.gl/Z0ZqJV
ReplyDelete