js+css实现一个移动端黑色酷炫的音乐app h5代码
代码语言:html
所属分类:多媒体
代码描述:js+css实现一个移动端黑色酷炫的音乐app h5代码,可以从曲库中添加音乐,还有播放控制器
代码标签: js css 移动端 黑色 酷炫 音乐 app h5 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <title>Aura Player</title> <style> /* --- 全局与主题 --- */ :root { --bg-color: #121212; --surface-color: #181818; --primary-text-color: #ffffff; --secondary-text-color: #b3b3b3; --accent-color-start: #8e2de2; --accent-color-end: #4a00e0; --card-color: #282828; } * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */ } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; background-color: var(--bg-color); color: var(--primary-text-color); overflow: hidden; /* 防止body滚动 */ overscroll-behavior: none; } /* --- 页面结构 --- */ .app-container { height: 100vh; display: flex; flex-direction: column; } .main-content { flex-grow: 1; overflow-y: auto; padding: 20px; padding-bottom: 150px; /* 为迷你播放器和导航栏留出空间 */ } .page { display: none; } .page.active { display: block; animation: fadeIn 0.5s ease; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } /* --- 底部导航栏 --- */ .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: 60px; background-color: var(--surface-color); display: flex; justify-content: space-around; align-items: center; z-index: 1000; border-top: 1px solid #282828; } .nav-item { cursor: pointer; color: var(--secondary-text-color); } .nav-item.active { color: var(--primary-text-color); } .nav-item svg { width: 28px; height: 28px; } /* --- 迷你播放器 --- */ #mini-player { position: fixed; bottom: 60px; /* 在导航栏之上 */ left: 0; width: 100%; height: 65px; background-color: var(--card-color); display: none; /* 默认隐藏 */ align-items: center; padding: 0 10px; cursor: pointer; z-index: 1001; transform: translateY(100%); transition: transform 0.3s ease-in-out; } #mini-player.visible { display: flex; transform: translateY(0); } #mini-player-art { width: 45px; height: 45px; border-radius: 4px; object-fit: cover; } .mini-player-info { flex-grow: 1; margin: 0 10px; overflow: hidden; } .mini-player-info .title { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mini-player-info .artist { font-size: 0.9em; color: var(--secondary-text-color); } #mini-player-controls button { background: none; border: none; color: var(--primary-text-color); padding: 10px; } #mini-player-controls svg { width: 24px; height: 24px; } /* --- 全屏播放器 --- */ #player-fullscreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(0,0,0,0.6), var(--bg-color) 60%); z-index: 2000; display: flex; flex-direction: column; justify-content: space-between; padding: 30px; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); } #player-fullscreen.visible { transform: translateY(0); } .fullscreen-header { display: flex; justify-content: space-between; align-items: center; } .fullscreen-header button { background: none; border: none; color: white; } .fullscreen-header svg { width: 24px; height: 24px; } .album-art-lg-container { display: flex; justify-content: center; align-items: center; flex-grow: 1; padding: 20px 0; } #album-art-lg { width: 80vw; max-width: 350px; height: 80vw; max-height: 350px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); object-fit: cover; } .song-info-lg { text-align: center; padding: 20px 0; } .song-info-lg .title { font-size: 1.5em; font-weight: bold; margin-bottom: 8px; } .song-info-lg .artist { font-size: 1.1em; color: var(--secondary-text-color); } .progress-container { width: 100%; margin: 10px 0; } #progress-bar { width: 100%; cursor: pointer; -webkit-appearance: none; appearance: none; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; } #progress-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: white; border-radius: 50%; cursor: pointer; } .time-stamps { display: flex; justify-content: space-between; font-size: 0.8em; color: var(--secondary-text-color); margin-top: 5px; } .main-controls { display: flex; justify-content: space-around; align-items: center; padding: 20px 0; } .main-controls button { background: none; border: none; color: white; } .main-controls svg { width: 28px; height: 28px; } #play-pause-lg-btn svg { width: 60px; height: 60px; } .secondary-controls button.active { color: #a77df5; } /* --- 通用组件 --- */ h1 { font-size: 2em; margin-bottom: 20px; } .album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; } .album-card { cursor: pointer; } .album-card img { width: 100%; border-radius: 8px; aspect-ratio: 1/1; object-fi.........完整代码请登录后点击上方下载按钮下载查看
网友评论0