mirror of https://github.com/toddmotto/echo.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
804 B
8 lines
804 B
/*! |
|
* Echo v1.3.0 |
|
* Lazy-loading images with data-* attributes |
|
* Project: https://github.com/toddmotto/echo |
|
* by Todd Motto: http://toddmotto.com |
|
* Copyright. MIT licensed. |
|
*/ |
|
window.Echo=function(a,b){"use strict";var c,d=function(c){var d=c.getBoundingClientRect();return(d.top>=0&&d.left>=0&&d.top)<=(a.innerHeight||b.documentElement.clientHeight)},e=function(b,c){return a.getComputedStyle?a.getComputedStyle(b,null).getPropertyValue(c):b.currentStyle[c]},f=function(){for(var a=0;a<c.length;a++){var b=c[a];d(b)&&"none"!==e(b,"display")&&"none"!==e(b.parentNode,"display")&&(b.src=b.getAttribute("data-echo"),[].indexOf&&-1!==[].slice.call(c).indexOf(b)&&[].slice.call(c).splice(a,1))}},g=function(){c=b.querySelectorAll("[data-echo]"),f(),a.onscroll=f};return{init:g}}(window,document);
|
|
|