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%);
    .........完整代码请登录后点击上方下载按钮下载查看

网友评论0