Skip to content

Commit a127c68

Browse files
committed
fix: v-scroll-fire get fired when reload the page quasarframework#2081
1 parent e274ae8 commit a127c68

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/directives/scroll-fire.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ export default {
2424
bind (el, binding) {
2525
let ctx = {
2626
scroll: debounce(() => {
27-
let containerBottom, elementBottom, fire
27+
let containerBottom, elBottom
2828

2929
if (ctx.scrollTarget === window) {
30-
elementBottom = el.getBoundingClientRect().bottom
31-
fire = elementBottom < window.innerHeight
30+
elBottom = el.getBoundingClientRect().bottom
31+
containerBottom = window.innerHeight
3232
}
3333
else {
34+
elBottom = offset(el).top + height(el)
3435
containerBottom = offset(ctx.scrollTarget).top + height(ctx.scrollTarget)
35-
elementBottom = offset(el).top + height(el)
36-
fire = elementBottom < containerBottom
3736
}
3837

39-
if (fire) {
38+
if (elBottom > 0 && elBottom < containerBottom) {
4039
ctx.scrollTarget.removeEventListener('scroll', ctx.scroll, listenOpts.passive)
4140
ctx.handler(el)
4241
}

0 commit comments

Comments
 (0)