102 lines
2.5 KiB
HTML
102 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>旋转木马式 3D 轮播图</title>
|
|
<!-- 引入 Swiper CSS -->
|
|
<link rel="stylesheet" href="https://unpkg.com/swiper@5.2.1/css/swiper.min.css">
|
|
<style>
|
|
/* 基础样式 */
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
background-color: #f0f0f0;
|
|
}
|
|
|
|
.swiper-container {
|
|
width: 80%; /* 容器宽度 */
|
|
height: 300px;
|
|
}
|
|
|
|
.swiper-slide {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: #3498db;
|
|
color: white;
|
|
font-size: 2rem;
|
|
border: 2px solid #2980b9;
|
|
box-sizing: border-box;
|
|
border-radius: 10px; /* 圆角效果 */
|
|
}
|
|
|
|
/* 分页器样式 */
|
|
.swiper-pagination {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
}
|
|
|
|
/* 导航按钮样式 */
|
|
.swiper-button-next,
|
|
.swiper-button-prev {
|
|
color: white;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
padding: 10px;
|
|
border-radius: 50%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Swiper 容器 -->
|
|
<div class="swiper-container">
|
|
<div class="swiper-wrapper">
|
|
<div class="swiper-slide">1</div>
|
|
<div class="swiper-slide">2</div>
|
|
<div class="swiper-slide">3</div>
|
|
<div class="swiper-slide">4</div>
|
|
<div class="swiper-slide">5</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 引入 Swiper JS -->
|
|
<script src="https://unpkg.com/swiper@5.2.1/js/swiper.min.js"></script>
|
|
<script>
|
|
const swiper = new Swiper('.swiper-container', {
|
|
effect: 'coverflow',
|
|
grabCursor: false,
|
|
centeredSlides: true,
|
|
slidesPerView: 3,
|
|
|
|
loop: true,
|
|
coverflowEffect: {
|
|
rotate: 0,
|
|
stretch: 0,
|
|
depth: 200,
|
|
modifier: 2,
|
|
scale: 1.8,
|
|
slideShadows: false,
|
|
},
|
|
pagination: {
|
|
el: '.swiper-pagination',
|
|
clickable: true,
|
|
},
|
|
navigation: {
|
|
nextEl: null,
|
|
prevEl: null,
|
|
},
|
|
autoplay: {
|
|
delay: 6000,
|
|
disableOnInteraction: false,
|
|
},
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |