Skip to content

Commit e56264a

Browse files
committed
ensure scroll offset is properly initialized on page load
1 parent 8fe5743 commit e56264a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

parallax.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* parallax.js v0.9 (http://pixelcog.github.io/parallax.js/)
2+
* parallax.js v0.9.1 (http://pixelcog.github.io/parallax.js/)
33
* Copyright (c) 2014 PixelCog, Inc.
44
* Licensed under MIT (https://github.com/pixelcog/parallax.js/blob/master/LICENSE)
55
*/
@@ -156,8 +156,8 @@
156156
// Parallax Static Methods
157157

158158
$.extend(Parallax, {
159-
scrollTop: 0,
160-
scrollLeft: 0,
159+
scrollTop: $window.scrollTop(),
160+
scrollLeft: $window.scrollLeft(),
161161
winHeight: 0,
162162
winWidth: 0,
163163
docHeight: 0,
@@ -171,7 +171,7 @@
171171
if (this.isReady) return;
172172

173173
$window
174-
.on('scroll.px.parallax', function(){
174+
.on('scroll.px.parallax load.px.parallax', function(){
175175
var scrollTopMax = Parallax.docHeight - Parallax.winHeight;
176176
var scrollLeftMax = Parallax.docWidth - Parallax.winWidth;
177177
Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, $window.scrollTop()));

parallax.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)