|
本帖最后由 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
|
|