Skip to content

Commit

Permalink
fix(zoom): don't toggle zoom on slides without zoom-container
Browse files Browse the repository at this point in the history
fixes #4535
  • Loading branch information
nolimits4web committed May 11, 2021
1 parent 575bc84 commit e1de61b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/zoom/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,13 @@ const Zoom = {
gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`);
}
if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
if (
!gesture.$imageEl ||
gesture.$imageEl.length === 0 ||
!gesture.$imageWrapEl ||
gesture.$imageWrapEl.length === 0
)
return;

gesture.$slideEl.addClass(`${params.zoomedSlideClass}`);

Expand Down Expand Up @@ -398,7 +404,13 @@ const Zoom = {
gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`);
}
if (!gesture.$imageEl || gesture.$imageEl.length === 0) return;
if (
!gesture.$imageEl ||
gesture.$imageEl.length === 0 ||
!gesture.$imageWrapEl ||
gesture.$imageWrapEl.length === 0
)
return;

zoom.scale = 1;
zoom.currentScale = 1;
Expand Down

0 comments on commit e1de61b

Please sign in to comment.