Browse Source

fix issue #83 (Image Inside a Scrollable div Would not be Loaded)

pull/84/head
ethonchan 10 years ago
parent
commit
f165561c2a
  1. 33
      src/echo.js

33
src/echo.js

@ -1,11 +1,20 @@
(function() { (function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(function() {
return factory(root);
});
} else if (typeof exports === 'object') {
module.exports = factory;
} else {
root.echo = factory(root);
}
})(this, function (root) {
'use strict'; 'use strict';
var echo = {}; var echo = {};
var root = {};
var callback = function () { var callback = function () {};
};
var offset, poll, delay, useDebounce, unload; var offset, poll, delay, useDebounce, unload;
@ -35,7 +44,7 @@
echo.init = function (opts) { echo.init = function (opts) {
opts = opts || {}; opts = opts || {};
root = opts.viewport || this || (0,eval)('this') root = opts.viewport || this || (0,eval)('this');
var offsetAll = opts.offset || 0; var offsetAll = opts.offset || 0;
var offsetVertical = opts.offsetVertical || offsetAll; var offsetVertical = opts.offsetVertical || offsetAll;
var offsetHorizontal = opts.offsetHorizontal || offsetAll; var offsetHorizontal = opts.offsetHorizontal || offsetAll;
@ -69,8 +78,8 @@
var view = { var view = {
l: 0 - offset.l, l: 0 - offset.l,
t: 0 - offset.t, t: 0 - offset.t,
b: (root.innerHeight || root.clientHeight) + offset.b, b: (root.innerHeight || document.documentElement.clientHeight) + offset.b,
r: (root.innerWidth || root.clientWidth) + offset.r r: (root.innerWidth || document.documentElement.clientWidth) + offset.r
}; };
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
elem = nodes[i]; elem = nodes[i];
@ -121,14 +130,6 @@
clearTimeout(poll); clearTimeout(poll);
}; };
if ((typeof module !== "undefined" && module !== null) && module.exports) {
module.exports = echo;
} else if (typeof define === 'function') {
define(function() {
return echo; return echo;
});
} else {
root.echo = echo;
}
}());
});

Loading…
Cancel
Save