使用方法:
1、head引入css文件
<link rel="stylesheet" href="css/base.css?version=19.3.9.1">
2、head引入js文件
<script src="js/jquery.min.js"></script>
3、body引入HTML代码
<div id="audio" class="audio audio-off"> <audio id="audio-my" src="soures/m1.mp3" preload="metadata"></audio> //默认第一首歌的路径地址必填 <div class="audio-head"> <div class="audio-head-tittle"> <div class="audio-head-tittle-text audio-head-tittle-text-off"></div> </div> <div class="audio-head-tittle-by"></div> </div> <div class="add"></div> <div class="min-time"></div> <div class="audio-img"> <canvas id="audio-img-canvas" width="200px" height="200px"></canvas> <div class="audio-img-cover audio-img-cover-off"></div> <canvas id="audio-img-canvas-play" class="audio-img-canvas-play-off" width="45px" height="200px"></canvas> </div> <div class="audio-text">歌词待更新</div> <div class="audio-by"> <div class="audio-by-all"> <span class="audio-by-now"></span> </div> <div class="audio-by-text"> <span class="audio-by-text-now">00:00</span> <span class="audio-by-text-all">00:00</span> </div> </div> <div class="audio-btn"> <div class="audio-btn-list audio-btn-list-off"></div> <div class="audio-btn-before"></div> <div class="audio-btn-play audio-btn-play-off audio-btn-play-off-a"></div> <div class="audio-btn-sound"></div> <div class="audio-btn-next"></div> </div> <div class="audio-sound"> <div class="audio-sound-all"> <span class="audio-sound-now"></span> <span class="audio-sound-art"></span> </div> </div> </div> <a class="audio-head-tittle-text-out"></a> <a class="audio-head-tittle-text-out-a"></a> <script src="js/base.js" type="text/javascript"></script>
4、打开base.js修改歌曲路径地址和名称
var audioName = ['m1', 'm2']; 只需修改这里面的参数即可,名称就是mp3文件名,支持中文名。
audio.src = 'soures/' + audioName[audioIndex] + '.mp3'; 这里是默认设置的,mp3文件夹路径。