当前位置:网站首页>Swiper rotates pictures and plays background music
Swiper rotates pictures and plays background music
2022-07-30 18:32:00 【letisgo5】
需求:Rotate the pictures in the folder on the browser,并播放音乐!!!
I also found it online at first,All kinds of charges so I thought of a whole,Currently, only carousel and playing music are implemented
效果图: Currently only supports click to start,Then start playing music and carousel pictures

代码(图片与html在同一目录,If it is not in the same directory, it needs to be adjustedsrc图片路径)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Swiper demo</title>
<!-- Link Swiper's CSS -->
<link href="https://cdn.bootcss.com/Swiper/4.3.0/css/swiper.min.css" rel="stylesheet">
<!-- Demo styles -->
<style>
html, body {
position: relative;
width: 100%;
height: 100%;
}
body {
margin: 0;
padding: 0;
}
.m-swiper-container{
width: 100%;}
.m-swiper-slide{
display: block; background-size: 100% 100%;}
.m-swiper-img{
width: 100%;}
</style>
</head>
<body>
<!--bgm-->
<audio id="myAudio" src="http://music.163.com/song/media/outer/url?id=1901371647.mp3" controls="controls" autoplay loop="true" hidden="true"></audio>
<button id="goBut">GO!!!!!</button>
<!-- Swiper -->
<div class="swiper-container m-swiper-container" id="m-swiper-container">
<div class="swiper-wrapper" id="m-swiper-wrapper"></div>
</div>
<!-- Swiper JS -->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/Swiper/4.3.0/js/swiper.min.js"></script>
<!-- Initialize Swiper -->
<script>
var hdfiles = ['1.png','2.png','3.png'];
$("#goBut").click(function () {
vMP3 = document.getElementById("myAudio");
vMP3.play();
document.getElementById("goBut").style.display = "none";
var swiperWrapper = $('#m-swiper-wrapper');
var html = '';
for (var i = 0; i < hdfiles.length; i++) {
html += '<a class="swiper-slide m-swiper-slide">' +
'<img src="' + hdfiles[i] + '" class="m-swiper-img">' +
'</a>';
}
swiperWrapper.html(html);
var swiper = new Swiper('#m-swiper-container', {
speed:300,
autoplay : {
delay:3000
},
loop: true
});
});
</script>
</body>
边栏推荐
- 【Pointing to Offer】Pointing to Offer 18. Delete the node of the linked list
- OneFlow源码解析:Op、Kernel与解释器
- ROS 环境使用第三方动态链接库(.so)文件
- LeetCode 练习——关于查找数组元素之和的两道题
- A senior with 13 years of experience in software testing, summed up 5 test employment suggestions....
- "Ruffian Heng Embedded Bimonthly" Issue 59
- 【剑指 Offe】剑指 Offer 17. 打印从1到最大的n位数
- node封装一个控制台进度条插件
- 深化校企合作 搭建技术技能人才成长“立交桥”
- CCNA-NAT协议(理论与实验练习)
猜你喜欢

使用postman调接口报Content type ‘text/plain;charset=UTF-8‘ not supported

中集世联达飞瞳全球工业人工智能AI领军者,全球顶尖AI核心技术高泛化性高鲁棒性稀疏样本持续学习,工业级高性能成熟AI产品规模应用

智慧中控屏

Basic use of scrapy

国轩高科瑞交所上市:募资近7亿美元 为瑞士今年最大融资项目

【剑指 Offer】剑指 Offer 22. 链表中倒数第k个节点

OneFlow源码解析:Op、Kernel与解释器

Recommended Books | Recommend 3 database books with rave reviews

kotlin by lazy

自然语言处理nltk
随机推荐
requet.getHeader(“token“) 为null
C# wpf 无边框窗口添加阴影效果
CCNA-ACL(访问控制列表)标准ACL 扩展ACL 命名ACL
毕业1年从事软件测试拿下11.5k,没有给98后丢脸吧...
kotlin的by lazy
DTSE Tech Talk丨第2期:1小时深度解读SaaS应用系统设计
延时队列优化 (2)
【每日一道LeetCode】——191. 位1的个数
ESP8266-Arduino编程实例-HC-SR04超声波传感器驱动
requet.getHeader("token") is null
ByteArrayInputStream class source code analysis
《痞子衡嵌入式半月刊》 第 59 期
【Swords Offer】Swords Offer 17. Print n digits from 1 to the largest
【PHPWord】Quick Start of PHPWord in PHPOffice Suite
第十六期八股文巴拉巴拉说(MQ篇)
Two-point answer naked question (plus a little pigeonhole principle)
Pytorch基础--tensorboard使用(一)
ByteArrayInputStream 类源码分析
【HMS Core】【FAQ】运动健康、音频编辑、华为帐号服务 典型问题合集7
reporter undercover