Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 724381f

Browse files
authored
fix for items recalculating on resize
Added an update method which simply updates items height and iOT after window resize
1 parent 28b5786 commit 724381f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/vue-parallax-js.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ ParallaxJS.prototype = {
4747
count: 0
4848
})
4949
},
50-
50+
update() {
51+
this.items.forEach(function(item) {
52+
let t = item.el;
53+
n = t.currentStyle || window.getComputedStyle(t);
54+
item.height = item.mod.absY ? window.innerHeight : t.clientHeight || t.scrollHeight
55+
item.iOT = t.offsetTop + t.offsetParent.offsetTop - parseInt(n.marginTop)
56+
})
57+
},
5158
move () {
5259
if (!this.active) return
5360
if (window.innerWidth < this.os.minWidth || 0) {
@@ -83,6 +90,7 @@ export default {
8390
p.move(p)
8491
}, { passive: true })
8592
window.addEventListener('resize', () => {
93+
p.update()
8694
p.move(p)
8795
}, { passive: true })
8896

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /