Browse Source

Updated with 'display' conditional

pull/6/head
Scott Vinkle 11 years ago
parent
commit
74797a4f14
  1. 6
      dist/echo.js

6
dist/echo.js vendored

@ -16,10 +16,14 @@ window.Echo = (function (window, document, undefined) {
return (coords.top >= 0 && coords.left >= 0 && coords.top) <= (window.innerHeight || document.documentElement.clientHeight); return (coords.top >= 0 && coords.left >= 0 && coords.top) <= (window.innerHeight || document.documentElement.clientHeight);
}; };
var _getStyle = function(el, prop) {
return window.getComputedStyle ? window.getComputedStyle(el, null).getPropertyValue(prop) : el.currentStyle[prop];
};
var _pollImages = function () { var _pollImages = function () {
for (var i = 0; i < store.length; i++) { for (var i = 0; i < store.length; i++) {
var self = store[i]; var self = store[i];
if (_inView(self)) { if (_inView(self) && (_getStyle(self, 'display') !== 'none' && _getStyle(self.parentNode, 'display') !== 'none')) {
self.src = self.getAttribute('data-echo'); self.src = self.getAttribute('data-echo');
if ([].indexOf && [].slice.call(store).indexOf(self) !== -1) { if ([].indexOf && [].slice.call(store).indexOf(self) !== -1) {
[].slice.call(store).splice(i, 1); [].slice.call(store).splice(i, 1);

Loading…
Cancel
Save