Swiper中文论坛
标题:
swiper5 click事件的问题
[打印本页]
作者:
rockstarsteve
时间:
2020-5-18 14:36
标题:
swiper5 click事件的问题
本帖最后由 rockstarsteve 于 2020-5-18 14:40 编辑
<!DOCTYPE
html
>
<
html
lang
="en"
>
<
head
>
<
meta
charset
="UTF-8"
>
<
title
>
Title
</
title
>
<
link
rel
="stylesheet"
href
="css/swiper.min.css"
>
<
script
src
="js/jquery-1.11.2.min.js"
></
script
>
<
script
src
="js/swiper.min.js"
></
script
>
</
head
>
<
body
>
<
div
class
="swiper-container"
>
<
div
class
="swiper-wrapper"
>
<
div
class
="swiper-slide"
>
slider1
</
div
>
<
div
class
="swiper-slide"
>
slider2
</
div
>
<
div
class
="swiper-slide"
>
slider3
</
div
>
</
div
>
</
div
>
<
script
>
var
mySwiper
=
new
Swiper
(
'.swiper-container'
, {
autoplay
: {
delay
:
1000
,
stopOnLastSlide
:
false
,
disableOnInteraction
:
true
,
},
on
: {
click
:
function
() {
console
.
log
(
'你点了Swiper'
);
},
},
})
</
script
>
</
body
>
</
html
>
当点击slide的时候会触发两次click的事件,控制台输出两行:
你点了Swiper
需求:应该只触发一次,输出一行
:
你点了Swiper
作者:
yukunokok
时间:
2024-6-4 14:23
这个解决了嘛
欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/)
Powered by Discuz! X3.2