Browse Source

add load event

pull/23/head
Gustavo Paes 11 years ago
parent
commit
5328997fbd
  1. 2
      dist/echo.js
  2. 2
      dist/echo.min.js
  3. 2
      src/echo.js

2
dist/echo.js vendored

@ -45,8 +45,10 @@ window.Echo = (function (window, document, undefined) {
if (document.addEventListener) { if (document.addEventListener) {
window.addEventListener('scroll', _throttle, false); window.addEventListener('scroll', _throttle, false);
window.addEventListener('load', _throttle, false);
} else { } else {
window.attachEvent('onscroll', _throttle); window.attachEvent('onscroll', _throttle);
window.attachEvent('onload', _throttle);
} }
}; };

2
dist/echo.min.js vendored

@ -5,4 +5,4 @@
* by Todd Motto: http://toddmotto.com * by Todd Motto: http://toddmotto.com
* Copyright. MIT licensed. * Copyright. MIT licensed.
*/ */
window.Echo=function(a,b){"use strict";var c,d,e,f=[],g=function(d){var e=d.getBoundingClientRect();return(e.top>=0&&e.left>=0&&e.top)<=(a.innerHeight||b.documentElement.clientHeight)+parseInt(c)},h=function(){for(var a=f.length;a--;){var b=f[a];g(b)&&(b.src=b.getAttribute("data-echo"),f.splice(a,1))}},i=function(){clearTimeout(e),e=setTimeout(h,d)},j=function(e){var g=b.querySelectorAll("[data-echo]"),h=e||{};c=h.offset||0,d=h.throttle||250;for(var j=0;j<g.length;j++)f.push(g[j]);i(),b.addEventListener?a.addEventListener("scroll",i,!1):a.attachEvent("onscroll",i)};return{init:j,render:i}}(window,document); window.Echo=function(a,b){"use strict";var c,d,e,f=[],g=function(d){var e=d.getBoundingClientRect();return(e.top>=0&&e.left>=0&&e.top)<=(a.innerHeight||b.documentElement.clientHeight)+parseInt(c)},h=function(){for(var a=f.length;a--;){var b=f[a];g(b)&&(b.src=b.getAttribute("data-echo"),f.splice(a,1))}},i=function(){clearTimeout(e),e=setTimeout(h,d)},j=function(e){var g=b.querySelectorAll("[data-echo]"),h=e||{};c=h.offset||0,d=h.throttle||250;for(var j=0;j<g.length;j++)f.push(g[j]);i(),b.addEventListener?(a.addEventListener("scroll",i,!1),a.addEventListener("load",i,!1)):(a.attachEvent("onscroll",i),a.attachEvent("onload",i))};return{init:j,render:i}}(window,document);

2
src/echo.js

@ -38,8 +38,10 @@ window.Echo = (function (window, document, undefined) {
if (document.addEventListener) { if (document.addEventListener) {
window.addEventListener('scroll', _throttle, false); window.addEventListener('scroll', _throttle, false);
window.addEventListener('load', _throttle, false);
} else { } else {
window.attachEvent('onscroll', _throttle); window.attachEvent('onscroll', _throttle);
window.attachEvent('onload', _throttle);
} }
}; };

Loading…
Cancel
Save