From 45b5a868f9825040178b8f28eb0d38fc3f4d0e62 Mon Sep 17 00:00:00 2001 From: blackout314 Date: Mon, 31 Mar 2014 10:33:11 +0000 Subject: [PATCH] add support to div background --- src/echo.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/echo.js b/src/echo.js index ce86a45..4519124 100644 --- a/src/echo.js +++ b/src/echo.js @@ -41,7 +41,11 @@ window.Echo = (function (global, document, undefined) { for (var i = 0; i < length; i++) { var self = store[i]; if (self && _inView(self)) { - self.src = self.getAttribute('data-echo'); + if (self.tagName.toLowerCase() !== 'img') { + self.style.cssText += "background-image: url('" + self.getAttribute('data-echo') + "');"; + } else { + self.src = self.getAttribute('data-echo'); + } callback(self); store.splice(i, 1); length = store.length;