Browse Source

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

pull/84/head
ethonchan 10 years ago
parent
commit
69dc18257c
  1. 32
      src/echo.js

32
src/echo.js

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

Loading…
Cancel
Save