From 74797a4f1441c9862bf5f7d29d4850857c18f553 Mon Sep 17 00:00:00 2001 From: Scott Vinkle Date: Mon, 25 Nov 2013 16:19:25 -0500 Subject: [PATCH] Updated with 'display' conditional --- dist/echo.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/echo.js b/dist/echo.js index 5eadf57..7dfb1c1 100644 --- a/dist/echo.js +++ b/dist/echo.js @@ -16,10 +16,14 @@ window.Echo = (function (window, document, undefined) { 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 () { for (var i = 0; i < store.length; 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'); if ([].indexOf && [].slice.call(store).indexOf(self) !== -1) { [].slice.call(store).splice(i, 1);