Skip to content

Commit 61112f4

Browse files
committed
reverse event definition order so they are triggered in the correct order on "load"
1 parent 58515f5 commit 61112f4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

parallax.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,21 +263,21 @@
263263

264264
var $doc = $(document), $win = $(window);
265265

266-
$win.on('scroll.px.parallax load.px.parallax', function() {
267-
var scrollTopMax = Parallax.docHeight - Parallax.winHeight;
268-
var scrollLeftMax = Parallax.docWidth - Parallax.winWidth;
269-
Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, $win.scrollTop()));
270-
Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft()));
271-
Parallax.overScroll = Math.max($win.scrollTop() - scrollTopMax, Math.min($win.scrollTop(), 0));
272-
Parallax.requestRender();
273-
})
274-
.on('resize.px.parallax load.px.parallax', function() {
266+
$win.on('resize.px.parallax load.px.parallax', function() {
275267
Parallax.winHeight = $win.height();
276268
Parallax.winWidth = $win.width();
277269
Parallax.docHeight = $doc.height();
278270
Parallax.docWidth = $doc.width();
279271
Parallax.isFresh = false;
280272
Parallax.requestRender();
273+
})
274+
.on('scroll.px.parallax load.px.parallax', function() {
275+
var scrollTopMax = Parallax.docHeight - Parallax.winHeight;
276+
var scrollLeftMax = Parallax.docWidth - Parallax.winWidth;
277+
Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, $win.scrollTop()));
278+
Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $win.scrollLeft()));
279+
Parallax.overScroll = Math.max($win.scrollTop() - scrollTopMax, Math.min($win.scrollTop(), 0));
280+
Parallax.requestRender();
281281
});
282282

283283
this.isReady = true;

parallax.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)