Browse Source

Possible solution to IE8 problem

Function to convert querySelector object to array.
pull/10/head
Benjamin J DeLong 11 years ago
parent
commit
18280dcaf3
  1. 17
      src/echo.js

17
src/echo.js

@ -10,18 +10,27 @@ window.Echo = (function (window, document, undefined) {
}; };
var _pollImages = function () { var _pollImages = function () {
for (var i = 0, len = store.length; i < len; i++) { var imgs = store.slice();
var self = store[i]; for (var i = 0, len = imgs.length; i < len; i++) {
var self = imgs[i];
if (_inView(self)) { if (_inView(self)) {
self.src = self.getAttribute('data-echo'); self.src = self.getAttribute('data-echo');
store.splice(i, 1); store.splice(i, 1);
} }
} }
}; };
var toArray (obj) {
var arr = [];
for (var i = 0, len = obj.length; i < len; i++) {
arr.push(obj[i]);
}
return arr;
}
var init = function () { var init = function () {
store = document.querySelectorAll('[data-echo]'); store = document.querySelectorAll('[data-echo]');
store = [].slice.call(store); store = toArray(store);
_pollImages(); _pollImages();
window.onscroll = _pollImages; window.onscroll = _pollImages;
}; };

Loading…
Cancel
Save