amazeui-echo
Advanced tools
Comparing version 1.7.0 to 1.7.3
11
echo.js
@@ -1,2 +0,2 @@ | ||
/*! echo.js v1.7.0 | (c) 2015 @toddmotto | https://github.com/toddmotto/echo */ | ||
/*! echo-js v1.7.3 | (c) 2016 @toddmotto | https://github.com/toddmotto/echo */ | ||
(function (root, factory) { | ||
@@ -22,3 +22,11 @@ if (typeof define === 'function' && define.amd) { | ||
var isHidden = function (element) { | ||
return (element.offsetParent === null); | ||
}; | ||
var inView = function (element, view) { | ||
if (isHidden(element)) { | ||
return false; | ||
} | ||
var box = element.getBoundingClientRect(); | ||
@@ -94,2 +102,3 @@ return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b); | ||
elem.removeAttribute('data-echo'); | ||
elem.removeAttribute('data-echo-background'); | ||
} | ||
@@ -96,0 +105,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! echo.js v1.7.0 | (c) 2015 @toddmotto | https://github.com/toddmotto/echo */ | ||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof exports?module.exports=e:t.echo=e(t)}(this,function(t){"use strict";var e,n,o,r,c,a={},d=function(){},u=function(t,e){var n=t.getBoundingClientRect();return n.right>=e.l&&n.bottom>=e.t&&n.left<=e.r&&n.top<=e.b},l=function(){(r||!n)&&(clearTimeout(n),n=setTimeout(function(){a.render(),n=null},o))};return a.init=function(n){n=n||{};var u=n.offset||0,i=n.offsetVertical||u,f=n.offsetHorizontal||u,s=function(t,e){return parseInt(t||e,10)};e={t:s(n.offsetTop,i),b:s(n.offsetBottom,i),l:s(n.offsetLeft,f),r:s(n.offsetRight,f)},o=s(n.throttle,250),r=n.debounce!==!1,c=!!n.unload,d=n.callback||d,a.render(),document.addEventListener?(t.addEventListener("scroll",l,!1),t.addEventListener("load",l,!1)):(t.attachEvent("onscroll",l),t.attachEvent("onload",l))},a.render=function(){for(var n,o,r=document.querySelectorAll("img[data-echo], [data-echo-background]"),l=r.length,i={l:0-e.l,t:0-e.t,b:(t.innerHeight||document.documentElement.clientHeight)+e.b,r:(t.innerWidth||document.documentElement.clientWidth)+e.r},f=0;l>f;f++)o=r[f],u(o,i)?(c&&o.setAttribute("data-echo-placeholder",o.src),null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+o.getAttribute("data-echo-background")+")":o.src=o.getAttribute("data-echo"),c||o.removeAttribute("data-echo"),d(o,"load")):c&&(n=o.getAttribute("data-echo-placeholder"))&&(null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+n+")":o.src=n,o.removeAttribute("data-echo-placeholder"),d(o,"unload"));l||a.detach()},a.detach=function(){document.removeEventListener?t.removeEventListener("scroll",l):t.detachEvent("onscroll",l),clearTimeout(n)},a}); | ||
/*! echo-js v1.7.3 | (c) 2016 @toddmotto | https://github.com/toddmotto/echo */ | ||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof exports?module.exports=e:t.echo=e(t)}(this,function(t){"use strict";var e,n,o,r,c,a={},u=function(){},d=function(t){return null===t.offsetParent},i=function(t,e){if(d(t))return!1;var n=t.getBoundingClientRect();return n.right>=e.l&&n.bottom>=e.t&&n.left<=e.r&&n.top<=e.b},l=function(){(r||!n)&&(clearTimeout(n),n=setTimeout(function(){a.render(),n=null},o))};return a.init=function(n){n=n||{};var d=n.offset||0,i=n.offsetVertical||d,f=n.offsetHorizontal||d,s=function(t,e){return parseInt(t||e,10)};e={t:s(n.offsetTop,i),b:s(n.offsetBottom,i),l:s(n.offsetLeft,f),r:s(n.offsetRight,f)},o=s(n.throttle,250),r=n.debounce!==!1,c=!!n.unload,u=n.callback||u,a.render(),document.addEventListener?(t.addEventListener("scroll",l,!1),t.addEventListener("load",l,!1)):(t.attachEvent("onscroll",l),t.attachEvent("onload",l))},a.render=function(){for(var n,o,r=document.querySelectorAll("img[data-echo], [data-echo-background]"),d=r.length,l={l:0-e.l,t:0-e.t,b:(t.innerHeight||document.documentElement.clientHeight)+e.b,r:(t.innerWidth||document.documentElement.clientWidth)+e.r},f=0;d>f;f++)o=r[f],i(o,l)?(c&&o.setAttribute("data-echo-placeholder",o.src),null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+o.getAttribute("data-echo-background")+")":o.src=o.getAttribute("data-echo"),c||(o.removeAttribute("data-echo"),o.removeAttribute("data-echo-background")),u(o,"load")):c&&(n=o.getAttribute("data-echo-placeholder"))&&(null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+n+")":o.src=n,o.removeAttribute("data-echo-placeholder"),u(o,"unload"));d||a.detach()},a.detach=function(){document.removeEventListener?t.removeEventListener("scroll",l):t.detachEvent("onscroll",l),clearTimeout(n)},a}); |
{ | ||
"name": "amazeui-echo", | ||
"version": "1.7.0", | ||
"description": "Lazy-loading with data-* attributes, offset and throttle options", | ||
"version": "1.7.3", | ||
"description": "echo.js 结合 Amaze UI 使用示例", | ||
"keywords": [ | ||
@@ -13,3 +13,3 @@ "amazeui", | ||
"license": "MIT", | ||
"homepage": "https://github.com/toddmotto/echo", | ||
"homepage": "http://amazeui.github.io/echo/", | ||
"repository": { | ||
@@ -21,21 +21,21 @@ "type": "git", | ||
"devDependencies": { | ||
"amazeui-doc-util": "^0.1.0", | ||
"browser-sync": "^1.9.0", | ||
"browserify": "^8.1.0", | ||
"amazeui-doc-util": "^0.7.1", | ||
"browser-sync": "^2.13.0", | ||
"browserify": "^13.0.1", | ||
"browserify-shim": "^3.8.2", | ||
"del": "^1.1.1", | ||
"del": "^2.2.1", | ||
"gulp": "^3.8.10", | ||
"gulp-autoprefixer": "^2.1.0", | ||
"gulp-csso": "^0.2.9", | ||
"gulp-gh-pages": "^0.4.0", | ||
"gulp-less": "^2.0.1", | ||
"gulp-load-plugins": "^0.8.0", | ||
"gulp-autoprefixer": "^3.1.0", | ||
"gulp-csso": "^2.0.0", | ||
"gulp-gh-pages": "^0.5.4", | ||
"gulp-less": "^3.1.0", | ||
"gulp-load-plugins": "^1.2.4", | ||
"gulp-rename": "^1.2.0", | ||
"markit-json": "^0.2.1", | ||
"run-sequence": "^1.0.2", | ||
"through2": "^0.6.3", | ||
"through2": "^2.0.1", | ||
"vinyl-transform": "^1.0.0" | ||
}, | ||
"dependencies": { | ||
"amazeui": "^2.1.0" | ||
"amazeui": "^2.7.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "browserify": { |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9955
1
Updatedamazeui@^2.7.0