jquery and zepto plugin for lazy load image, video
the idea is to replace link to img or to iframe and show it when is in view.
{ init : function (node) {}, // after replace tag we can run callback loadClass : 'load', // class added to original link tag before replacement tag : 'img' // replace original link to this tag }
- Load image
<a href="*.jpg" class="lazy">my new car image</a>
$('a.lazy').lazy();
- Load video from youtube
<a class="lazy-frame" href="http://www.youtube.com/embed/uahfKA-vU8M">Video</a>
$('a.lazy-frame').lazy({tag: 'iframe'});