简体   繁体   中英

how to enable select text in swiper.js

我正在使用该库进行滑动,按预期工作正常,但是我遇到了文本选择问题,因此如何启用<div class="swiper-slide>some text </div>选择文本

By default the click event acts as a touch event and the slide follow the mouse movement when you hold it. I have two solutions to select text inside a slide.

Option 1

You can wrap your text with a span element with class swiper-no-swiping to disable swiping only on the text.

<div class="swiper-slide"><span class="swiper-no-swiping">some text</span></div>

Option 2

You can use the simulateTouch parameter to disable the click event as touch event in the whole area of the slides.

new Swiper('.swiper-container', { simulateTouch: false });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM