酷吧音乐盒
来源:
浏览:0
2023-10-29 02:09:07
酷吧音乐盒
.
.
.
.
.left-
.
.button-
.
.current-
.
酷吧音乐盒
上一曲
下一曲
上一首
下一首
上一首
下一首
歌曲列表
歌曲标题
歌曲时长
歌曲进度
上一首
下一首
const songs = [
{
"title": "歌曲1",
"duration": "3分钟",
"current": 0,
"prev": null,
"next": null
},
{
"title": "歌曲2",
"duration": "2分钟",
"current": 30,
"prev": null,
"next": null
},
{
"title": "歌曲3",
"duration": "4分钟",
"current": 60,
"prev": null,
"next": null
}
];
const controls = document.querySelector("#controls");
const songTable = document.getElementById("songs-table");
controls.addEventListener("collapse", (e) => {
e.preventDefault();
const newSong = e.target.querySelector("tbody").insertRow(e.currentIndex);
newSong.insertCell("title").innerHTML = songs[e.currentIndex].title;
newSong.insertCell("duration").innerHTML = songs[e.currentIndex].duration;
newSong.insertCell("current").innerHTML = songs[e.currentIndex].current;
newSong.insertCell("prev").innerHTML = songs[e.currentIndex].prev;
newSong.insertCell("next").innerHTML = songs[e.currentIndex].next;
songTable.insertRow(newSong);
});
controls.addEventListener("change", (e) => {
const targetId = e.target.id.slice(1);
const newSong = songs.find((song) => song.id === targetId);
if (newSong) {
const current = song.current;
const duration = song.duration;
const prev = song.prev;
const next = song.next;
songs.splice(song.index, 1, {
title: newSong.title,
duration: newSong.duration,
current: current,
prev: prev,
next: next
});
songTable.update(songs);
}
});
const songList = document.getElementById("songs-table-body");
const songTable = document.getElementById("songs-table");
for (let i = 0; i
- 分类:社交软件
- 大小:66.2 MB
- 语言:简体中文
- 版本:其它