1个回答
展开全部
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/4.5.0/css/swiper.min.css">
<style>
.swiper-wrapper {
height: 300px;
}
.swiper-slide {
display: flex;
justify-content: center;
align-items: center;
}
.swiper-slide:nth-child(1) {
background: red;
}
.swiper-slide:nth-child(2) {
background: green;
}
.swiper-slide:nth-child(3) {
background: blue;
}
</style>
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
</div>
</body>
<script src="https://cdn.bootcss.com/Swiper/4.5.0/js/swiper.min.js"></script>
<script language="javascript">
var mySwiper = new Swiper(document.querySelector(".swiper-container"), {
autoplay: true,
})
document.querySelector('.swiper-container').onmouseover = () => {
mySwiper.autoplay.stop();
}
document.querySelector('.swiper-container').onmouseout = () => {
mySwiper.autoplay.start();
}
</script>
</html>
请采纳
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询