博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
音乐播放器
阅读量:4562 次
发布时间:2019-06-08

本文共 3702 字,大约阅读时间需要 12 分钟。

1、找到音乐文件用<audio>标签嵌入到HTML中

2、找到音乐的lrc歌词,复制在HTML中,可设为隐藏

3、[00:01.00]刀郎-西海情歌 类似于这样的,我用的是split();分割,找到每一句的播放时间

4、调用audio.currentTime(歌曲当前播放时间)与歌词时间进行匹配

音乐播放器

  

$().ready(function(){	var gbqq = document.getElementById("xxqq");	var t = new Array();	var sing = 0;	$("#play").click(function(){		var j = 1;		if(sing == 0){			gbqq.play();			setInterval(function(){					if(t[j] == parseInt(gbqq.currentTime)){					$("#col"+j+"").addClass("col");					j++;				}			},1000);			sing = 1;			$("#play").val("||");		}		else{			gbqq.pause();			sing = 0;			$("#play").val("▲");		}	})	var lyrics = $("#lyrics").html();	var lyString = lyrics.toString();	var lyStringSpl1 = lyString.split("[");	var arr = new Array();	var time = new Array();	var p = new Array();	var now = 0;	var i = 0;	var htm = "";	for(;i
" + arr[i].slice(-1)+"

"; time[i] = arr[i].slice(-2,-1).toString(); p[i] = time[i].split(":"); } $("#right_bottom").html(htm); var j = 0; for(;j

  

@charset "UTF-8";*{margin: 0;padding: 0}body{background-image: url("../images/bg.jpg");background-repeat: no-repeat;background-attachment:fixed;background-position: center;}#music{width: 680px;height: 480px;position: relative;margin:80px auto auto;border-radius: 8px;overflow:hidden;box-shadow:0 0 20px #12171A; }#music #left{width: 500px;height: 410px;float: left;background-repeat: no-repeat;text-align: center;background-color: #12171A;background: rgba(0,0,0,0.7);}#music #left img{margin-top:80px;}#music #right{width: 180px;height: 410px;background-color: #12171A;float: right;background: rgba(0,0,0,0.9);}#music #right #right_top{width: 100%;height: 156px;padding-top: 20px;}#music #right #right_top #right_img{margin: 0px auto;width: 130px;border-radius: 50%;overflow:hidden;}#music #right #right_top #right_fond{text-align: center;color: white;width: 100%;font-family: 华文新魏;line-height: 20px;}#music #right #right_bottom{background:rgba(0,0,0,1.0);width: 100%;height: 234px;overflow-y:scroll;color: #fff;font-family: 华文新魏;text-align: center;line-height: 25px}#music #bottom{width: 100%;height: 70px;float: left;background-color:#12171A ;background:rgba(0,0,0,0.8);}#music #bottom #btn{width: 190px;height: 50px;margin: 10px auto;text-align: center;}#music #bottom #btn .play{height: 80%;width:40px;margin: 5px auto; }#music #bottom #btn .s{width: 30px;height: 30px;}#music #bottom #btn input {border-radius: 50px;border: 0 solid;cursor: pointer;outline: none;}#right_bottom::-webkit-scrollbar{display: none;}.col{color: red;}

  

转载于:https://www.cnblogs.com/0710whh/p/9361237.html

你可能感兴趣的文章
教你用shell写CGI程序
查看>>
窗口 对话框 Pop Dialog 示例
查看>>
ubuntu(centos) server安装vmware tools
查看>>
数据结构之最大不重复串
查看>>
为什么要配置sdk-tools/platform-toools?
查看>>
自己动手开发更好用的markdown编辑器-07(扩展语法)
查看>>
maven dependency:tree中反斜杠的含义
查看>>
队列的循环队列
查看>>
程序中的日期格式
查看>>
大众点评CAT错误总结以及解决思路
查看>>
C# 你什么让程序员寂寞成酱紫 (男生版 娱乐中学习 抽象类 接口 继承 实现方法 )...
查看>>
MyEclipse 检出新项目后,如果项目名称签名有个红色感叹号
查看>>
Java开发环境系列:一篇能解决你99%问题的排雷日记
查看>>
从0开始学爬虫3之xpath的介绍和使用
查看>>
HTML fieldset和legend标签
查看>>
Shell成长之路
查看>>
使用kmeans聚类观察京东物流优化挑战赛的数据
查看>>
同一天有重复请假
查看>>
POJ 1410 Intersection --几何,线段相交
查看>>
第一册:lesson eighty one.
查看>>