diff --git a/src/echo.js b/src/echo.js index a3bd0b3..ff60607 100644 --- a/src/echo.js +++ b/src/echo.js @@ -2,7 +2,7 @@ window.Echo = (function (window, document, undefined) { 'use strict'; - var store; + var store = []; var _inView = function (img) { var coords = img.getBoundingClientRect(); @@ -19,7 +19,9 @@ window.Echo = (function (window, document, undefined) { }; var init = function () { - store = Array.prototype.slice.call(document.querySelectorAll('[data-echo]')); + var nodes = document.querySelectorAll('[data-echo]'); + for (var i = nodes.length; i--; store.unshift(nodes[i])); + _pollImages(); window.onscroll = _pollImages; };