diff --git a/dist/echo.js b/dist/echo.js index c49a802..1f284aa 100644 --- a/dist/echo.js +++ b/dist/echo.js @@ -123,8 +123,8 @@ window.Echo = (function (global, document, undefined) { } offset = { - t: optionToInt(opts.offsetBot, offsetVertical), - b: optionToInt(opts.offsetTop, offsetVertical), + t: optionToInt(opts.offsetTop, offsetVertical), + b: optionToInt(opts.offsetBot, offsetVertical), l: optionToInt(opts.offsetLeft, offsetHorizontal), r: optionToInt(opts.offsetRight, offsetHorizontal) }; diff --git a/dist/echo.min.js b/dist/echo.min.js index 8dc7188..70035f4 100644 --- a/dist/echo.min.js +++ b/dist/echo.min.js @@ -1,2 +1,2 @@ /*! Echo v1.5.0 | (c) 2014 @toddmotto | MIT license | github.com/toddmotto/echo */ -window.Echo=function(a,b){"use strict";var c,d,e,f,g=[],h=[],i=function(){},j=function(a,b){var c=a.getBoundingClientRect();return c.right>=b.l&&c.bottom>=b.t&&c.left<=b.r&&c.top<=b.b},k=function(){var a,d,e,k,l=g.length;if(k={l:0-c.l,t:0-c.t,b:(window.innerHeight||b.documentElement.clientHeight)+c.b,r:(window.innerWidth||b.documentElement.clientWidth)+c.r},l>0)for(d=0;l>d;d++)e=g[d],e&&j(e,k)&&(f&&(e.setAttribute("data-echo-placeholder",e.src),h.push(e)),e.src=e.getAttribute("data-echo"),i(e,"load"),g.splice(d,1),l=g.length,d--);if(a=h.length,a>0)for(d=0;a>d;d++)e=h[d],e&&!j(e,k)&&(e.src=e.getAttribute("data-echo-placeholder"),i(e,"unload"),h.splice(d,1),a=h.length,d--,g.push(e));0===a&&0===l&&n()},l=function(){clearTimeout(e),e=setTimeout(k,d)},m=function(e){function j(a,b){return parseInt(a||b,10)}var m=b.querySelectorAll("img[data-echo]");e=e||{};var n=e.offset||0,o=e.offsetVertical||n,p=e.offsetHorizontal||n;c={t:j(e.offsetBot,o),b:j(e.offsetTop,o),l:j(e.offsetLeft,p),r:j(e.offsetRight,p)},d=j(e.throttle,250),f=!!e.unload,i=e.callback||i,g=[],h=[];for(var q=0;q=b.l&&c.bottom>=b.t&&c.left<=b.r&&c.top<=b.b},k=function(){var a,d,e,k,l=g.length;if(k={l:0-c.l,t:0-c.t,b:(window.innerHeight||b.documentElement.clientHeight)+c.b,r:(window.innerWidth||b.documentElement.clientWidth)+c.r},l>0)for(d=0;l>d;d++)e=g[d],e&&j(e,k)&&(f&&(e.setAttribute("data-echo-placeholder",e.src),h.push(e)),e.src=e.getAttribute("data-echo"),i(e,"load"),g.splice(d,1),l=g.length,d--);if(a=h.length,a>0)for(d=0;a>d;d++)e=h[d],e&&!j(e,k)&&(e.src=e.getAttribute("data-echo-placeholder"),i(e,"unload"),h.splice(d,1),a=h.length,d--,g.push(e));0===a&&0===l&&n()},l=function(){clearTimeout(e),e=setTimeout(k,d)},m=function(e){function j(a,b){return parseInt(a||b,10)}var m=b.querySelectorAll("img[data-echo]");e=e||{};var n=e.offset||0,o=e.offsetVertical||n,p=e.offsetHorizontal||n;c={t:j(e.offsetTop,o),b:j(e.offsetBot,o),l:j(e.offsetLeft,p),r:j(e.offsetRight,p)},d=j(e.throttle,250),f=!!e.unload,i=e.callback||i,g=[],h=[];for(var q=0;q