杰网资源 Design By www.escxy.com
本文实例为大家分享了JS实现音乐钢琴的具体代码,供大家参考,具体内容如下
知识点
1.keydown键盘按下事件
2.ev[‘keyCode'] 获取当前按键
3.引入工具库工具库
运行效果
1-9控制按键
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
div{
height: 50px;
width: 630px;
/*background-color: red;*/
position: absolute;
top: 300px;
left: 50%;
transform: translateX(-50%);
}
ul{
height: 100%;
width: 100%;
list-style: none;
display: flex;
overflow: hidden;
border: 1px solid #000;
}
li{
height: 100%;
width: 100%;
/*background-color: yellow;*/
position: relative;
border-right: 1px dashed #000;
}
li:last-child{
border-right:none
}
span{
width: 70px;
height: 50px;
background-color: skyblue;
position: absolute;
left: 0;
top: 50px;
z-index: -1;
}
a{
text-decoration: none;color: #000;
line-height: 50px;
position: absolute;
left: 50%;
transform: translateX(-50%);
font-size: 20px;
cursor: default;
}
</style>
</head>
<body>
<div id="box">
<ul id="ul">
<li><a href="">1</a><span></span>
<audio src="/UploadFiles/2021-04-02/a1.mp3">
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
标签:
js,钢琴
杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com
暂无评论...




