Skip to content

Commit

Permalink
feat(zoom): support Zoom in CSS Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Aug 6, 2021
1 parent 3503ced commit 4639702
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/modules/zoom/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
gesture.$imageWrapEl.length === 0
)
return;
if (swiper.params.cssMode) {
swiper.wrapperEl.style.overflow = 'hidden';
swiper.wrapperEl.style.touchAction = 'none';
}

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

Expand Down Expand Up @@ -446,7 +450,10 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
gesture.$imageWrapEl.length === 0
)
return;

if (swiper.params.cssMode) {
swiper.wrapperEl.style.overflow = '';
swiper.wrapperEl.style.touchAction = '';
}
zoom.scale = 1;
currentScale = 1;
gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)');
Expand Down
1 change: 0 additions & 1 deletion src/types/swiper-options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export interface SwiperOptions {
* This is what is not supported when it is enabled:
*
* - Some effects (Fade, Flip, Cube)
* - Zoom
* - `speed` parameter may not have no effect
* - All transition start/end related events (use `slideChange` instead)
* - `slidesPerGroup` has limited support
Expand Down

0 comments on commit 4639702

Please sign in to comment.