Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 85db420

Browse files
committed
delegate asscroll block event
1 parent 86b2306 commit 85db420

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/Scroll.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default class Scroll {
6464
})
6565

6666
E.delegate('click', 'a[href^="#"]', this.toggleFixedContainer)
67+
E.delegate('wheel', this.options.blockScrollClass, this.blockScrollEvent)
6768

6869
}
6970

@@ -185,8 +186,6 @@ export default class Scroll {
185186
this.scrollTargets = newTargets.length ? newTargets : [newTargets]
186187
this.scrollTargetsLength = this.scrollTargets.length
187188
}
188-
189-
!this.scrollBlockElements && this.updateScrollBlockElements()
190189

191190
this.iframes = this.scrollContainer.querySelectorAll('iframe')
192191

@@ -272,13 +271,6 @@ export default class Scroll {
272271
}
273272
}
274273

275-
updateScrollBlockElements() {
276-
this.scrollBlockElements = document.querySelectorAll(this.options.blockScrollClass)
277-
for (let i = 0; i < this.scrollBlockElements.length; i++) {
278-
this.scrollBlockElements[i].addEventListener('wheel', this.blockScrollEvent)
279-
}
280-
}
281-
282274
blockScrollEvent(e) {
283275
e.stopPropagation()
284276
}

0 commit comments

Comments
 (0)