Skip to content

Commit 9d8c91c

Browse files
ENGCOM-8407: Avoid binding magnifier events in duplicate on resize #30695
- Merge Pull Request #30695 from fredden/magento2:magnifier-resize-performance - Merged commits: 1. 6bec772 2. 693e366 3. 2bb781f
2 parents be82efb + 2bb781f commit 9d8c91c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/web/magnifier/magnifier.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,13 @@
401401
}
402402

403403
function bindEvents(eType, thumb) {
404+
var eventFlag = 'hasBoundEvent_' + eType;
405+
if (thumb[eventFlag]) {
406+
// Events are already bound, no need to bind in duplicate
407+
return;
408+
}
409+
thumb[eventFlag] = true;
410+
404411
switch (eType) {
405412
case 'hover':
406413
hoverEvents(thumb);

0 commit comments

Comments
 (0)