Skip to content

Commit

Permalink
fix(zoom): zoom elements only in swiper-zoom-container
Browse files Browse the repository at this point in the history
fixes #4847
  • Loading branch information
nolimits4web committed Aug 23, 2021
1 parent 7cd2e75 commit a4e351f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/modules/zoom/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
if (!gesture.$slideEl || !gesture.$slideEl.length) {
gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`);
if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageEl = gesture.$slideEl
.find(`.${params.containerClass}`)
.eq(0)
.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`);
gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio;
if (gesture.$imageWrapEl.length === 0) {
Expand Down Expand Up @@ -341,7 +344,10 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
}
}

gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageEl = gesture.$slideEl
.find(`.${params.containerClass}`)
.eq(0)
.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`);
}
if (
Expand Down Expand Up @@ -440,7 +446,10 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
} else {
gesture.$slideEl = swiper.slides.eq(swiper.activeIndex);
}
gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageEl = gesture.$slideEl
.find(`.${params.containerClass}`)
.eq(0)
.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`);
}
if (
Expand Down

0 comments on commit a4e351f

Please sign in to comment.