Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

javascript - 缩放图像时是否可以禁用滑动功能?(Is it possible to disable the swipe functionality when the image is zoomed?)

I am using angular2-useful-swiper wrapper for iDangerous Swiper for a project and I need to disable the swiping functionality when the image is zoomed.

(我使用angular2-useful-swiper包装器iDangerous Swiper的一个项目,我需要当图像被放大禁用刷卡功能。)

In Swiper Api there is nothing about this, so the question: is it possible?

(在Swiper Api中 ,对此一无所获,所以问题来了:可能吗?)

  ask by Ferie translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

as a work-around, you could subscribe to swiper's 'zoomChange' event and based on the scale (one of 3 args of it) update the mySwiper.allowTouchMove to false .

(作为一种变通方法,您可以订阅swiper的'zoomChange'事件,然后基于比例(其中3个参数之一)将mySwiper.allowTouchMove更新为false 。)

that worked for me in the Vue app.

(在Vue应用中对我有用。)

my use-case

(我的用例)

yourCallbackToEvent(scale) {
  yourSwiper.allowTouchMove = scale === 1;
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...