js+css实现带播放列表的音乐播放器代码

代码语言:html

所属分类:多媒体

代码描述:js+css实现带播放列表的音乐播放器代码,通过json来设置播放源,有播放列表和音乐切换功能、还有音乐封面显示。

代码标签: js css 播放 列表 音乐 播放器 代码

下面为部分代码预览,完整代码请点击下载或在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 {
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0