草系:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
第249行: | 第249行: | ||
<div class="sprite-name">389辛奇帕克</div> | <div class="sprite-name">389辛奇帕克</div> | ||
</div> | </div> | ||
<style> | |||
#floating-player { | |||
position: fixed; | |||
bottom: 20px; | |||
right: 20px; | |||
background: rgba(0, 0, 0, 0.8); | |||
border-radius: 12px; | |||
padding: 10px 14px; | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
z-index: 9999; | |||
width: 240px; | |||
font-family: sans-serif; | |||
color: white; | |||
} | |||
#floating-player button { | |||
margin: 6px; | |||
padding: 6px 12px; | |||
border-radius: 6px; | |||
border: none; | |||
background: #444; | |||
color: white; | |||
cursor: pointer; | |||
} | |||
#floating-player button:hover { | |||
background: #666; | |||
} | |||
#progress { | |||
width: 100%; | |||
margin-top: 8px; | |||
height: 6px; | |||
background: #222; | |||
border-radius: 4px; | |||
overflow: hidden; | |||
} | |||
#bar { | |||
height: 100%; | |||
width: 0%; | |||
background: #66f; | |||
} | |||
</style> | |||
<div id="floating-player"> | |||
<div> | |||
<button onclick="bgm.play()">▶ 播放</button> | |||
<button onclick="bgm.pause()">⏸ 暂停</button> | |||
</div> | |||
<div id="progress"><div id="bar"></div></div> | |||
</div> | |||
<audio id="bgm" src="https://d1rtq9slcl72gh.cloudfront.net/audio/home.mp3" autoplay loop></audio> | |||
<script> | |||
const bgm = document.getElementById('bgm'); | |||
const bar = document.getElementById('bar'); | |||
setInterval(() => { | |||
if (!bgm.duration) return; | |||
const percent = (bgm.currentTime / bgm.duration) * 100; | |||
bar.style.width = percent + '%'; | |||
}, 300); | |||
</script> | |||
</html> | </html> |