We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7196442 commit 25bfa9aCopy full SHA for 25bfa9a
src/Magnifier.js
@@ -98,9 +98,10 @@ export default class Magnifier extends PureComponent {
98
this.img.addEventListener('touchmove', this.onTouchMove, { passive: false });
99
this.img.addEventListener('touchend', this.onTouchEnd, { passive: false });
100
101
- // Re-calculate image bounds on resize and scroll
+ // Re-calculate image bounds on window resize
102
window.addEventListener('resize', this.calcImgBoundsDebounced);
103
- window.addEventListener('scroll', this.calcImgBoundsDebounced);
+ // Re-calculate image bounds on scroll (useCapture: catch scroll events in entire DOM)
104
+ window.addEventListener('scroll', this.calcImgBoundsDebounced, true);
105
}
106
107
componentWillUnmount() {
0 commit comments