欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

html5全屏圖片手風琴幻燈片展示代碼

吉茹定2年前9瀏覽0評論

HTML5全屏圖片手風琴幻燈片展示是一種非常流行的網(wǎng)頁設(shè)計效果,通常用于網(wǎng)站首頁或產(chǎn)品展示頁面。以下是一個簡單的實現(xiàn)代碼:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全屏手風琴幻燈片展示</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Microsoft Yahei', sans-serif;
}
body {
background-color: #f1f1f1;
}
.slideshow-container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.image-container {
display: flex;
justify-content: center;
align-items: center;
flex: 1;
}
.image-container img {
max-width: 100%;
max-height: 100%;
transition: all 0.5s ease-out;
}
.active {
flex: 5;
}
.inactive {
flex: 1;
opacity: 0.5;
}
</style>
</head>
<body>
<div class="slideshow-container">
<div class="image-container active">
<img src="1.jpg" alt="">
</div>
<div class="image-container inactive">
<img src="2.jpg" alt="">
</div>
<div class="image-container inactive">
<img src="3.jpg" alt="">
</div>
<div class="image-container inactive">
<img src="4.jpg" alt="">
</div>
</div>
<script>
var currentSlide = 0;
var slides = document.querySelectorAll('.image-container');
setInterval(function() {
slides[currentSlide].classList.remove('active');
slides[currentSlide].classList.add('inactive');
currentSlide = (currentSlide + 1) % slides.length;
slides[currentSlide].classList.remove('inactive');
slides[currentSlide].classList.add('active');
}, 5000);
</script>
</body>
</html>

以上代碼實現(xiàn)了一個四張圖片的幻燈片展示效果,每5秒鐘切換一次。其中,利用了flex布局和CSS過渡動畫實現(xiàn)了手風琴效果。