|
|
@ -10,8 +10,9 @@ 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); |
|
|
@ -19,9 +20,17 @@ window.Echo = (function (window, document, undefined) { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
}; |
|
|
|
}; |
|
|
|