js+css实现带播放列表的音乐播放器代码
代码语言:html
所属分类:多媒体
代码描述:js+css实现带播放列表的音乐播放器代码,通过json来设置播放源,有播放列表和音乐切换功能、还有音乐封面显示。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.5.15.3.css"> <style> @import url("https://fonts.googleapis.com/css2?family=Kelly+Slab&display=swap"); * { margin: 0; padding: 0; box-sizing: border-box; } body { height: 100vh; font-family: "Kelly Slab", cursive; background: #232427; } body .card { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 270px; height: 430px; background: transparent; backdrop-filter: blur(10px); overflow: hidden; border-radius: 15px; box-shadow: inset 5px 5px 5px rgba(0, 0, 0, 0.2), inset -5px -5px 15px rgba(255, 255, 255, 0.1), 0px 0px 0px rgba(0, 0, 0, 0.3), 0px 0px 0px rgba(255, 255, 255, 0.1); } body .player { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 220px; height: 380px; overflow: hidden; border-radius: 15px; } body .player .main { width: 100%; height: 100%; background: transparent; transition: all 0.5s ease-in-out; } body .player .main .thumbnail img { width: 100%; } body .player .main .seekbar { margin-top: -15px; } body .player .main .seekbar input[type=range] { -webkit-appearance: none; width: 100%; height: 5px; outline: none; background: linear-gradient(to right, #f7ff00, #db36a4); overflow: hidden; } body .player .main .seekbar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 0px; height: 0px; box-shadow: -300px 0px 0px 300px #00acee; } body .player .main .details { text-align: center; padding: 20px 0; } body .player .main .details h2 { font-size: 1em; letter-spacing: 3px; margin-bottom: 5px; color: #4158D0; background-image: linear-gradient(45deg, #4158D0 15%, #C850C0 75%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } body .player .main .details p { font-size: 0.9em; color: #fff; } body .player .main .details p:hover { text-decoration: underline; } body .player .main .controls { display: flex; justify-content: center; } body .player .main .controls .bground { padding: 5px; border-radius: 50%; background-image: linear-gradient(45deg, #4158D0 0%, #C850C0 45%, #FFCC70 100%); } body .player .main .controls i.fa { font-size: 0.8em; padding-top: 4px; background-color: #fff; -webkit-background-clip: text; -webkit-text-fill-color: transparent; } body .player .main .controls i.fa::before { padding: 5px; } body .player .main .controls i.fas, body .player .main .controls i.far { font-size: 0.7em; color: #4158D0; background-image: linear-gradient(45deg, #4158D0 15%, #C850C0 75%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } body .player .main .controls > div { margin: 0 7px; cursor: pointer; } body .player .main .controls > div.play-pause-control i.fa-play { display: none; } body .player .main .controls > div.play-pause-control.paused i.fa-play { display: block; } body .player .main .controls > div.play-pause-control.paused i.fa-pause { display: none; } body .player .player-list { position: absolute; width: 100%; margin-top: -20px; height: 380px; overflow: scroll; background: rgba(0, 0, 0, 0.8); z-index: 2; transition: all 0.5s ease-in-out; } body .player .player-list .toggle-list { top: 0; text-align: center; height: 20px; line-height: 20px; background-color: #21D4FD; background-image: linear-gradient(45deg, #4158D0 0%, #C850C0 45%, #FFCC70 100%); } body .player .player-list .toggle-list i.fa { color: #fff; font-size: 1em; font-weight: 600; } body .player .player-list .toggle-list i.fa-angle-down { display: none; } body .player .player-list .toggle-list .toggle-list.active i.fa-angle-up { display: block; } body .player .player-list .toggle-list .toggle-list.active i.fa-angle-down { display: none; } body .player .player-list .list { padding: 10px; } body .player .player-list .list .item { display: flex; padding: 8px 0; border-bottom: 1px solid #444; cursor: pointer; } body .player .player-list .list .item .thumbnail { width: 40px; height: 40px; overflow: hidden; } body .player .player-list .list .item .thumbnail img { width: 100%; height: 100%; } body .player .player-list .list .item .details { display: flex; flex-direction: column; justify-content: center; padding: 5px 10px; } body .player .player-list .list .item .details h2 { font-size: 1em; color: #f7ff00; background-color: #FBDA61; background-image: linear-gradient(45deg, #FBDA61 0%, #FF5ACD 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } body .player .player-list .list .item .details p { color: #fff; font-size: 0.8em; } body .player .player-list::-webkit-scrollbar { width: 0; background: #222; } body .player .player-list::-webkit-scrollbar-thumb { background: #00acee; } body .player.activeSongList .player-list { margin-top: -330px; } body .player.activeSongList .main { filter: blur(5px); } /*FullScreen Button*/ button { position: absolute; bottom: 5%; right: 5%; color: #fff; border: transparent; border-radius: 15px; font-size: 0.9rem; padding: 0.5rem 0.9em; background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4); background-size: 400%; z-index: 1; font-weight: bold; cursor: pointer; transition: all 0.5s; z-index: 10; } button:hover { animation: animate 8s linear infinite; } button:focus { outline: none; } @keyframes animate { 0% { background-position: 0; } 100% { background-position: 400%; } } </style> </head> <body> <!-- partial:index.partial.html --> <div class="card"> <div class="player"> <div class="main"> <audio><!--Upload mp3 on the https://jukehost.co.uk/--></audio> <div class="thumbnail"> <img src=""> </div> <div class="seekbar"> <input type="range"> </div> <div class="details"> <h2></h2> <p></p> </div> <div class=&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0