| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 | <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Document</title>    <script src="./rem.js"></script>    <link rel="stylesheet" href="./css/iconfont.css">    <style>        body {            margin: 0;        }        ul {            margin: 0;            padding: 0;        }        li {            list-style: none;        }        p{            margin: 0;        }        .container {            font-size: .36rem;        }        /* 头部  */        .top-head{            position: fixed;            top: 0;            left: 0;            width: 100vw;        }        .top-head header {            background-color: #e54847;            height: 0.7rem;            text-align: center;            line-height: 0.7rem;            position: relative;        }        .top-head header span {            color: #fff;        }        .top-head .more-btn {            position: absolute;            right: 20px;            top: 0;        }        .top-head .more-btn ul {            display: none;            position: absolute;            top: 0.5rem;            left: -1.5rem;            width: 2rem;            z-index: 1;            box-shadow: 0 .06rem .18rem 0 rgba(0, 0, 0, .1);        }        .top-head .more-btn .active {            display: block;        }        .top-head .more-btn ul li {            height: .9rem;            line-height: .9rem;            font-size: 0.3rem;            text-align: center;            color: #333;            background-color: #fff;            border-bottom: .02rem solid #f0f0f0;        }        .top-head .more-btn img {            width: .3rem;            height: .3rem;        }        /* 头部导航 */        .top-head nav {            height: .9rem;            border-bottom: 0.02rem solid #e6e6e6;            display: flex;            justify-content: space-between;            padding: 0 .2rem;            align-items: center;            background-color: #fff;        }        .top-head .nav-center {            flex-grow: 3;            margin: 0 .2rem;            position: relative;        }        .top-head .nav-center ul {            display: flex;            justify-content: space-around;            font-size: .3rem;            font-weight: 700;            color: #666;            align-items: center;        }        .top-head .nav-center .bottom-line {            position: absolute;            bottom: -5px;            width: .4rem;            height: 3px;            border-radius: 3px;            background-color: #f03d37;            transition: left .1s linear;        }        .top-head .nav-center[data-tab-val="one"] .bottom-line {            left: 4vw;        }        .top-head .nav-center[data-tab-val="two"] .bottom-line {            left: 18vw;        }        .top-head .nav-center[data-tab-val="three"] .bottom-line {            left: 32vw;        }        .top-head .nav-center[data-tab-val="four"] .bottom-line {            left: 49vw;        }        .top-head .nav-center .active {            color: #333;            font-size: .34rem;        }        .top-head .nav-right {            flex-grow: 1;            display: flex;            align-items: center;            justify-content: center;        }        .top-head .nav-right img {            width: .4rem;            height: .4rem;        }        .top-head .nav-left {            display: flex;            align-items: center;        }        .top-head .nav-left span {            color: #666;            font-size: .3rem;        }        .top-head .nav-left i {            border-top: 5px solid #666;            border-left: 5px solid transparent;            border-right: 5px solid transparent;            border-bottom: 5px solid transparent;            transform: translate(3px, 3px);        }        /* 底部导航 */        .bottom-nav{            height: 1rem;            width: 100vw;            border-top: .01rem solid #d8d8d8;            position: fixed;            bottom: 0;            left: 0;            background-color: #fff;        }        .bottom-nav ul{            display: flex;        }        .bottom-nav ul li{            flex-grow: 1;            height: 1rem;            display: flex;            flex-direction: column;            align-items: center;            justify-content: center;            color: #696969;        }        .bottom-nav ul .active{            color: #f03d37;        }        .bottom-nav ul li span{            font-size: .2rem;        }        .bottom-nav li i{            font-size: .5rem;        }        /* 中间内容区域 */        .center-content{            padding-top: 1.6rem;            padding-bottom: 1rem;        }        .center-content .love-move{            padding: 12px 15px;        }        .center-content .love-move .move-box{            width: 85px;            height: 115px;        }        .center-content .love-move img{            width: 100%;            height: 100%;        }        .center-content .love-move .cc-title{            font-size: 14px;            color: #333;            margin-bottom: 12px;        }        .center-content .love-move .move-box{            position: relative;            margin-bottom: 6px;        }        .center-content .love-move .rating-content{            position: absolute;            bottom: 0;            left: 0;            height: 35px;            width: 100%;            font-size: 11px;            color: #faaf00;            background-image: linear-gradient(-180deg,rgba(77,77,77,0),#000);        }        .center-content .rating-content span{            position: absolute;            left: 4px;            bottom: 2px;        }        .center-content .love-move .move-title{            font-size: 13px;            color: #222;        }        .center-content .love-move ul{            display: flex;            overflow: scroll;        }        .center-content .love-move li{            margin-right: 10px;        }        ::-webkit-scrollbar{            display: none;            width: 0;            height: 0;        }    </style></head><body>    <div class="container">        <div class="top-head">            <header>                <span>猫眼电影</span>                <div class="more-btn">                    <img id="list-btn" src="./img/list.png" alt="list">                    <ul class="">                        <li>首页</li>                        <li>榜单</li>                        <li>热点</li>                        <li>商城</li>                    </ul>                </div>            </header>            <nav>                <div class="nav-left">                    <span>哈尔滨</span>                    <i></i>                </div>                <div class="nav-center" data-tab-val="one">                    <ul>                        <li data-tab="one" class="active">热播</li>                        <li data-tab="two">影院</li>                        <li data-tab="three">待映</li>                        <li data-tab="four">经典电影</li>                    </ul>                    <div class="bottom-line"></div>                </div>                <div class="nav-right">                    <img src="./img/search.png" alt="img">                </div>            </nav>        </div>        <div class="center-content">            <div class="love-move">                <p class="cc-title">最受好评电影</p>                <ul>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                    <li>                        <div class="move-box">                            <img src="./img/move.jpg" alt="move">                            <div class="rating-content">                                <span>观众评分 8.9</span>                            </div>                        </div>                        <p class="move-title"> 神偷奶爸4</p>                    </li>                </ul>                </div>            <div class="move-list">                            </div>        </div>        <div class="bottom-nav">            <ul>                <li class="active">                    <i class="iconfont icon-dianying"></i>                    <span>电影/影院</span>                </li>                <li>                    <i class="iconfont icon-shipin-"></i>                    <span>视频</span>                </li>                <li>                    <i class="iconfont icon-yanchu"></i>                    <span>演出</span>                </li>                <li>                    <i class="iconfont icon-yonghu"></i>                    <span>我的</span>                </li>            </ul>        </div>    </div>    <script>        let listBtn = document.querySelector("#list-btn");        //控制顶部菜单栏的显示和隐藏        listBtn.ontouchstart = function () {            //toggle 切换 菜单 ul 上面active类 如果有就移除 如果没有就添加            this.nextElementSibling.classList.toggle("active");        }        let navCenter = document.querySelector(".nav-center");        let navList = navCenter.querySelectorAll("li");        // 循环为列表按钮添加点击事件        for (let i = 0; i < navList.length; i++) {            navList[i].ontouchstart = function (e) {                // 循环消除所有按钮的选中状态                for (let j = 0; j < navList.length; j++) {                    navList[j].classList.remove("active")                }                // 为当前按钮添加选中状态                this.classList.add("active");                // 获取当前按钮dataset值                let thisTab = e.target.dataset.tab                // 为父元素添加data-tab-val值以控制下划线的移动位置                navCenter.setAttribute("data-tab-val", thisTab)                // 向前地址中添加选中按钮的hash值                location.hash = thisTab;            }        }        // 监听hash值变化修改选中项        window.onhashchange = function () {            let thisHash = location.hash.substr(1).trim();            if (thisHash) {                navCenter.setAttribute("data-tab-val", thisHash);                for (let i = 0; i < navList.length; i++) {                    if (navList[i].dataset.tab == thisHash) {                        navList[i].classList.add("active");                    } else {                        navList[i].classList.remove("active");                    }                }            }else{                navCenter.setAttribute("data-tab-val", "one");                for (let i = 0; i < navList.length; i++) {                    navList[i].classList.remove("active");                }                navList[0].classList.add("active");            }        }        /**         * 底部导航点击事件        */        let bottomNavLi = document.querySelector(".bottom-nav").querySelectorAll("li");        for(let i=0;i<bottomNavLi.length;i++){            bottomNavLi[i].ontouchstart = function(){                for(let j=0;j<bottomNavLi.length;j++){                    bottomNavLi[j].classList.remove("active");                }                this.classList.add("active");            }        }   </script></body></html>
 |