- UID
- 1152
- 主题
- 回帖
- 0
- 精华
- 积分
- 7722
- 金币
- 枚
- 草籽
- 颗
- 鲜花
- 朵
- 注册时间
- 2025-4-16
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2025-11-2 19:09
|
显示全部楼层
要学习代码的可套用,这代码是明码,代码我写清楚了,发表时去除所有中文行如:/* 可根据需要调整透明度 */。你可照着做。
代码多数是英文与数字组成,如中文嵌入数据流慢打开图就慢切记。
- <style>
- #mydiv {
- margin: 130px 0 30px calc(50% - 900px);
- display: grid;
- place-items: center;
- width: 1700px;
- height: 850px;
- box-shadow: 3px 3px 20px #000;
- user-select: none;
- overflow: hidden;
- position: relative;
- z-index: 1;
- }
- #vid {
- position: absolute;
- width: 130%;
- height: 130%;
- object-fit: cover;
- pointer-events: none;
- mix-blend-mode: screen;
- mask: linear-gradient(to top right, red 88%, transparent 0);
- -webkit-mask: linear-gradient(to top right, red 88%, transparent 0);
- z-index: 6;
- opacity: .35;
- }
- /* 轮播图片样式 */
- .slide {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-size: cover;
- background-position: center;
- background-repeat: no-repeat;
- opacity: 0;
- transition: opacity 1s ease-in-out;
- z-index: 0;
- }
- /* 初始显示第一张图片 */
- .slide:first-child {
- opacity: 1;
- }
- /* 人物图样式 - 置于最上层 */
- #character {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184734g56zkx55ai55zx52.png');
- background-size: cover;
- background-position: center;
- background-repeat: no-repeat;
- z-index: 10; /* 确保在最上层 */
- }
- </style>
-
- <div id="mydiv">
- <audio id="aud" src="https://ting8.yymp3.com/new23/yanyidan/8.mp3" autoplay loop></audio>
- <video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/08/29/5d2053251a075.mp4" autoplay="" loop="" muted=""></video>
-
- <!-- 轮播图片组 -->
- <div class="slide" style="background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184732smvxd8z484df4emk.jpg');"></div>
- <div class="slide" style="background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184732sou9br9bxpdooucu.jpg');"></div>
- <div class="slide" style="background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184733fnnaykewkfezywmt.jpg');"></div>
- <div class="slide" style="background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184733lzl535mm1531zi3z.jpg');"></div>
- <div class="slide" style="background-image: url('https://kkshan.com/data/attachment/forum/202511/02/184734di6dgdipaxrdxvz6.jpg');"></div>
-
- <!-- 人物图 -->
- <div id="character"></div>
- </div>
- <script>
- // 实现图片轮播效果
- let currentIndex = 0;
- const slides = document.querySelectorAll('.slide');
- const totalSlides = slides.length;
- function showNextSlide() {
- // 隐藏当前图片
- slides[currentIndex].style.opacity = 0;
-
- // 计算下一张图片索引
- currentIndex = (currentIndex + 1) % totalSlides;
-
- // 显示下一张图片
- slides[currentIndex].style.opacity = 1;
- }
- // 每3秒切换一张图片
- setInterval(showNextSlide, 3000);
- </script>
复制代码 |
评分
-
3
查看全部评分
-
|