Skip to content

Commit fd84e2c

Browse files
committed
Visibility is checked before applying transforms, to increase scrolling
performance.
1 parent 647049c commit fd84e2c

File tree

3 files changed

+100
-4
lines changed

3 files changed

+100
-4
lines changed

parallax.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@
225225

226226
if (this.boxOffsetBottom > scrollTop && this.boxOffsetTop <= scrollBottom) {
227227
this.visibility = 'visible';
228+
this.mirrorTop = this.boxOffsetTop - scrollTop;
229+
this.mirrorLeft = this.boxOffsetLeft - scrollLeft;
230+
this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed);
228231
} else {
229232
this.visibility = 'hidden';
230233
}
231-
this.mirrorTop = this.boxOffsetTop - scrollTop;
232-
this.mirrorLeft = this.boxOffsetLeft - scrollLeft;
233-
this.offsetTop = this.offsetBaseTop - this.mirrorTop * (1 - this.speed);
234234

235235
this.$mirror.css({
236236
transform: 'translate3d(0px, 0px, 0px)',

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)