/*! * jQuery Lazy - min - v0.1.4 * http://jquery.eisbehr.de/lazy/ * * Copyright 2013, Daniel 'Eisbehr' Kern * * Dual licensed under the MIT and GPL v2 licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * * jQuery("img.lazy").lazy(); */ (function(e,t,n,r){e.fn.lazy=function(r){function o(t){if(typeof t!="boolean")t=false;s.each(function(){var n=e(this);if(n.attr(i.attribute)&&n.attr(i.attribute)!=n.attr("src")&&!n.data("loaded")&&(n.is(":visible")||!i.visibleOnly)){if(a(n)||t){if(i.afterLoad)n.bind("load",function(){i.afterLoad(n);n.unbind("load")});if(i.beforeLoad)i.beforeLoad(n);n.hide().attr("src",n.attr(i.attribute))[i.effect](i.effectTime);n.data("loaded",true);if(i.onLoad)i.onLoad(n);if(i.removeAttribute)n.removeAttr(i.attribute)}}});s=e(s).filter(function(){return!e(this).data("loaded")})}function u(){if(i.delay>=0)setTimeout(function(){o(true)},i.delay);if(i.delay<0||i.combined){o();e(t).bind("scroll",l(i.throttle,o));e(t).bind("resize",l(i.throttle,o))}}function a(e){var t=n.documentElement.scrollTop?n.documentElement.scrollTop:n.body.scrollTop;if(t+f()+i.threshold>e.offset().top+e.height()){return true}return false}function f(){if(t.innerHeight)return t.innerHeight;if(n.documentElement&&n.documentElement.clientHeight)return n.documentElement.clientHeight;if(n.body&&n.body.clientHeight)return n.body.clientHeight;if(n.body&&n.body.offsetHeight)return n.body.offsetHeight;return i.fallbackHeight}function l(e,t){function s(){function o(){r=+(new Date);t.apply()}var s=+(new Date)-r;n&&clearTimeout(n);if(s>e||!i.enableThrottle)o();else n=setTimeout(o,e-s)}var n;var r=0;return s}var i={bind:"load",threshold:300,fallbackHeight:2e3,visibleOnly:true,delay:-1,combined:false,attribute:"data-src",removeAttribute:true,effect:"show",effectTime:0,enableThrottle:false,throttle:250,beforeLoad:null,onLoad:null,afterLoad:null,onError:null};if(r)e.extend(i,r);var s=this;if(i.bind=="load")e(t).load(u);else if(i.bind=="event")u();if(i.onError)s.bind("error",function(){i.onError(e(this))});return this};e.fn.Lazy=e.fn.lazy})(jQuery,window,document)