Skip to content

Commit fbdfe48

Browse files
committed
version 1.0.3
1 parent 48f5a73 commit fbdfe48

28 files changed

+135
-95
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jQueryMobile framework.
4646
Currently tested in IE 6-11, Chrome 1-31, Firefox 1.5-27.0, Safari 3-7, Opera 10.6-18.0, iOS 5-7, Android 2.3-4.4,
4747
Amazon Kindle Fire 2 and HD 8.9, Opera Mini 7.
4848

49-
**Required jQuery 1.7+ or Zepto 1.0+.**
49+
**Required jQuery 1.7+, Zepto 1.0+, or DOMtastic 0.7.2+ (note: `attr`, `class`, `data`, `event`, `selector`, and `type` modules are required).**
5050

5151

5252
## Download / Install
@@ -804,6 +804,7 @@ Note that any of Lazy Load XT `dist` files may be loaded from CDN, not only `jqu
804804
805805
## Version History
806806
807+
- [**1.0.3**](https://github.com/ressio/lazy-load-xt/tree/1.0.3) (28.05.2014): support DOMstatic library (`attr`, `class`, `data`, `event`, `selector`, and `type` modules are required); fix loading of images on browser's tab activation
807808
- [**1.0.2**](https://github.com/ressio/lazy-load-xt/tree/1.0.2) (05.03.2014): fix work in jQuery Mobile 1.4
808809
- [**1.0.1**](https://github.com/ressio/lazy-load-xt/tree/1.0.1) (16.02.2014): fix triggering `lazyload` and `lazyerror`
809810
events in `scrset` and `picture` addons

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lazyloadxt",
3-
"description": "Lazy Load XT is mobile-oriented, fast and extensible jQuery plugin for lazy loading of images, videos and other media with built-in support of jQueryMobile framework. It improves performance of website by loading visible media elements only, and elements below the fold are loaded after page scroll. The plugin has many options, supports callbacks and special lazy events, that allows to have different loading effects (e.g. fade in and spinner effects). Examples of plugin and its addons include ajax, background images, infinite scroll, horizontal scroll, iframe-based widgets (YouTube, Vimeo, Google Maps Engine Lite, Facebook recommend button, Google+ profile), html5 video, responsive images with retina support (srcset and picture polyfills), social widgets (embedded tweet, Twitter share button, Google Plus badge and share button, Facebook like and recommend buttons, Facebook post comments), load all images before print, etc. Tested in IE 6-11, Chrome 1-31, Firefox 1.5-27.0, Safari 3-7, Opera 10.6-18.0, iOS 5-7, Android 2.3-4.4, and WP8. Requires jQuery 1.7+ or Zepto 1.0+.",
4-
"version": "1.0.2",
3+
"description": "Lazy Load XT is mobile-oriented, fast and extensible jQuery plugin for lazy loading of images, videos and other media with built-in support of jQueryMobile framework. It improves performance of website by loading visible media elements only, and elements below the fold are loaded after page scroll. The plugin has many options, supports callbacks and special lazy events, that allows to have different loading effects (e.g. fade in and spinner effects). Examples of plugin and its addons include ajax, background images, infinite scroll, horizontal scroll, iframe-based widgets (YouTube, Vimeo, Google Maps Engine Lite, Facebook recommend button, Google+ profile), html5 video, responsive images with retina support (srcset and picture polyfills), social widgets (embedded tweet, Twitter share button, Google Plus badge and share button, Facebook like and recommend buttons, Facebook post comments), load all images before print, etc. Tested in IE 6-11, Chrome 1-31, Firefox 1.5-27.0, Safari 3-7, Opera 10.6-18.0, iOS 5-7, Android 2.3-4.4, and WP8. Requires jQuery 1.7+, Zepto 1.0+, or DOMtastic 0.7.2+.",
4+
"version": "1.0.3",
55
"main": ["dist/jquery.lazyloadxt.js", "dist/jquery.lazyloadxt.extra.js"],
66
"authors": ["RESS.io"],
77
"homepage": "http://ressio.github.io/lazy-load-xt",

dist/jquery.lazyloadxt.autoload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Lazy Load XT v1.0.2 2014-03-05
1+
/*! Lazy Load XT v1.0.3 2014-05-28
22
* http://ressio.github.io/lazy-load-xt
33
* (C) 2014 RESS.io
44
* Licensed under MIT */
@@ -15,4 +15,4 @@
1515
}, options.autoLoadTime);
1616
});
1717

18-
})(window.jQuery || window.Zepto);
18+
})(window.jQuery || window.Zepto || window.$);

dist/jquery.lazyloadxt.autoload.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.lazyloadxt.bg.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Lazy Load XT v1.0.2 2014-03-05
1+
/*! Lazy Load XT v1.0.3 2014-05-28
22
* http://ressio.github.io/lazy-load-xt
33
* (C) 2014 RESS.io
44
* Licensed under MIT */
@@ -16,4 +16,4 @@
1616
.removeAttr(bgAttr);
1717
});
1818

19-
})(window.jQuery || window.Zepto);
19+
})(window.jQuery || window.Zepto || window.$);

dist/jquery.lazyloadxt.bg.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.lazyloadxt.extra.js

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Lazy Load XT v1.0.2 2014-03-05
1+
/*! Lazy Load XT v1.0.3 2014-05-28
22
* http://ressio.github.io/lazy-load-xt
33
* (C) 2014 RESS.io
44
* Licensed under MIT */
@@ -20,7 +20,7 @@
2020
forceLoad: forceLoad, // force auto load all images
2121

2222
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
23-
updateEvent: 'load orientationchange resize scroll touchmove', // page-modified events
23+
updateEvent: 'load orientationchange resize scroll touchmove focus', // page-modified events
2424
forceEvent: '', // force loading of all elements
2525

2626
//onstart: null,
@@ -45,6 +45,15 @@
4545
$data = $.data || function (el, name) {
4646
return $(el).data(name);
4747
},
48+
// $.contains is not included into DOMtastic, so implement it there
49+
$contains = $.contains || function (parent, el) {
50+
while (el = el.parentNode) {
51+
if (el === parent) {
52+
return true;
53+
}
54+
}
55+
return false;
56+
},
4857
elements = [],
4958
topLazy = 0,
5059
/*
@@ -66,6 +75,13 @@
6675
return obj[prop] === undefined ? options[prop] : obj[prop];
6776
}
6877

78+
/**
79+
* @returns {number}
80+
*/
81+
function scrollTop() {
82+
var scroll = window.pageYOffset;
83+
return (scroll === undefined) ? docElement.scrollTop : scroll;
84+
}
6985

7086
/**
7187
* Add new elements to lazy-load list:
@@ -89,19 +105,19 @@
89105
elementOptionsOverrides[prop] = getOrDef(overrides, prop);
90106
}
91107

92-
return this.each(function () {
93-
if (this === window) {
108+
return this.each(function (el) {
109+
if (el === window) {
94110
$(options.selector).lazyLoadXT(overrides);
95111
} else {
96112
// prevent duplicates
97-
if (checkDuplicates && $data(this, dataLazied)) {
113+
if (checkDuplicates && $data(el, dataLazied)) {
98114
return;
99115
}
100116

101-
var $el = $(this).data(dataLazied, 1);
117+
var $el = $(el).data(dataLazied, 1);
102118

103-
if (blankImage && $el[0].tagName === 'IMG' && !this.src) {
104-
this.src = blankImage;
119+
if (blankImage && el.tagName === 'IMG' && !el.src) {
120+
el.src = blankImage;
105121
}
106122

107123
// clone elementOptionsOverrides object
@@ -126,9 +142,12 @@
126142
if ($isFunction(handler)) {
127143
handler.call($el[0]);
128144
} else {
129-
$el
130-
.addClass(handler.addClass || '')
131-
.removeClass(handler.removeClass || '');
145+
if (handler.addClass) {
146+
$el.addClass(handler.addClass);
147+
}
148+
if (handler.removeClass) {
149+
$el.removeClass(handler.removeClass);
150+
}
132151
}
133152
}
134153

@@ -161,9 +180,9 @@
161180

162181
topLazy = Infinity;
163182

164-
var viewportTop = $window.scrollTop(),
165-
viewportHeight = window.innerHeight || $window.height(),
166-
viewportWidth = window.innerWidth || $window.width(),
183+
var viewportTop = scrollTop(),
184+
viewportHeight = window.innerHeight || docElement.clientHeight,
185+
viewportWidth = window.innerWidth || docElement.clientWidth,
167186
i,
168187
length;
169188

@@ -176,7 +195,7 @@
176195
topEdge;
177196

178197
// remove items that are not in DOM
179-
if (!$.contains(docElement, el)) {
198+
if (!$contains(docElement, el)) {
180199
removeNode = true;
181200
} else if (force || !objData.visibleOnly || el.offsetWidth || el.offsetHeight) {
182201

@@ -246,7 +265,7 @@
246265

247266
// fast check for scroll event without new visible elements
248267
if (e && e.type === 'scroll' && e.currentTarget === window) {
249-
if (topLazy >= $window.scrollTop()) {
268+
if (topLazy >= scrollTop()) {
250269
return;
251270
}
252271
}
@@ -292,8 +311,7 @@
292311
}
293312
});
294313

295-
})(window.jQuery || window.Zepto, window, document);
296-
314+
})(window.jQuery || window.Zepto || window.$, window, document);
297315

298316
(function ($) {
299317
var options = $.lazyLoadXT;
@@ -308,13 +326,13 @@
308326
$el
309327
.attr('poster', $el.attr(options.videoPoster))
310328
.children('source,track')
311-
.each(function () {
312-
var $child = $(this);
329+
.each(function (el) {
330+
var $child = $(el);
313331
$child.attr('src', isFuncSrcAttr ? srcAttr($child) : $child.attr(srcAttr));
314332
});
315333

316334
// reload video
317335
this.load();
318336
});
319337

320-
})(window.jQuery || window.Zepto);
338+
})(window.jQuery || window.Zepto || window.$);

dist/jquery.lazyloadxt.extra.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.lazyloadxt.fadein.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Lazy Load XT v1.0.2 2014-03-05
1+
/*! Lazy Load XT v1.0.3 2014-05-28
22
* http://ressio.github.io/lazy-load-xt
33
* (C) 2014 RESS.io
44
* Licensed under MIT */

dist/jquery.lazyloadxt.fadein.min.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
/* Lazy Load XT 1.0.2 | MIT License */
1+
/* Lazy Load XT 1.0.3 | MIT License */
22

33
.lazy-hidden{opacity:0}.lazy-loaded{-webkit-transition:opacity .3s;-moz-transition:opacity .3s;-ms-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s;opacity:1}

0 commit comments

Comments
 (0)