Skip to content

Commit b3ce71c

Browse files
committed
fix bug which reset initial scroll value to 0 for parallax calculations
1 parent ffff9af commit b3ce71c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

parallax.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* parallax.js v1.0 (http://pixelcog.github.io/parallax.js/)
2+
* parallax.js v1.0.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
*/
@@ -169,12 +169,12 @@
169169
// Parallax Static Methods
170170

171171
$.extend(Parallax, {
172-
scrollTop: $window.scrollTop(),
173-
scrollLeft: $window.scrollLeft(),
172+
scrollTop: 0,
173+
scrollLeft: 0,
174174
winHeight: 0,
175175
winWidth: 0,
176-
docHeight: 0,
177-
docWidth: 0,
176+
docHeight: 1 << 30,
177+
docWidth: 1 << 30,
178178
sliders: [],
179179
isReady: false,
180180
isFresh: false,
@@ -184,14 +184,14 @@
184184
if (this.isReady) return;
185185

186186
$window
187-
.on('scroll.px.parallax load.px.parallax', function(){
187+
.on('scroll.px.parallax load.px.parallax', function() {
188188
var scrollTopMax = Parallax.docHeight - Parallax.winHeight;
189189
var scrollLeftMax = Parallax.docWidth - Parallax.winWidth;
190190
Parallax.scrollTop = Math.max(0, Math.min(scrollTopMax, $window.scrollTop()));
191191
Parallax.scrollLeft = Math.max(0, Math.min(scrollLeftMax, $window.scrollLeft()));
192192
Parallax.requestRender();
193193
})
194-
.on('resize.px.parallax load.px.parallax', function(){
194+
.on('resize.px.parallax load.px.parallax', function() {
195195
Parallax.winHeight = $window.height();
196196
Parallax.winWidth = $window.width();
197197
Parallax.docHeight = $(document).height();

parallax.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.

0 commit comments

Comments
 (0)