Skip to content

Commit 822364d

Browse files
committed
bind to both window and document (as scroll event doesn't bubble), fix issue ressio#3
1 parent 9595e4e commit 822364d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/jquery.lazyloadxt.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
visibleOnly: true
4242
},
4343
$window = $(window),
44+
$document = $(document),
4445
$isFunction = $.isFunction,
4546
$extend = $.extend,
4647
$data = $.data || function (el, name) {
@@ -279,14 +280,16 @@
279280
/**
280281
* Initialization
281282
*/
282-
$(document).ready(function () {
283+
$document.ready(function () {
283284
triggerEvent('start', $window);
284285

285286
$window
286287
.on(options.loadEvent, initLazyElements)
287288
.on(options.updateEvent, queueCheckLazyElements)
288289
.on(options.forceEvent, forceLoadAll);
289290

291+
$document.on(options.updateEvent, queueCheckLazyElements);
292+
290293
if (options.autoInit) {
291294
initLazyElements(); // standard initialization
292295
}

0 commit comments

Comments
 (0)