• Netflix Mobile Navigation


    DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous" />
        <link rel="stylesheet" href="style.css" />
        <title>Netflix Mobile Navigationtitle>
      head>
      <body>
        <button class="nav-btn open-btn">
          <i class="fas fa-bars">i>
        button>
    
        <img src="https://logos-download.com/wp-content/uploads/2016/03/Netflix_Logo_2014-700x188.png" alt="Logo" class="logo">
        <p class="text">Mobile Navigationp>
    
        <div class="nav nav-black">
          <div class="nav nav-red">
            <div class="nav nav-white">
              <button class="nav-btn close-btn">
                <i class="fas fa-times">i>
              button>
    
              <img src="https://logos-download.com/wp-content/uploads/2016/03/Netflix_Logo_2014-700x188.png" alt="Logo" class="logo">
    
              <ul class="list">
                <li><a href="#">Teamsa>li>
                <li><a href="#">Locationsa>li>
                <li><a href="#">Life at Netflixa>li>
                <li>
                  <ul>
                    <li><a href="#">Netflix culture memoa>li>
                    <li><a href="#">Work life balancea>li>
                    <li><a href="#">Inclusion & diversitya>li>
                    <li><a href="#">Bloga>li>
                  ul>
                li>
              ul>
            div>
          div>
        div>
    
        <script src="script.js">script>
      body>
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    @import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
    
    * {
      box-sizing: border-box;
    }
    
    body {
      font-family: 'Muli', sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100vh;
    }
    
    .text {
      text-transform: uppercase;
    }
    
    .logo {
      width: 150px;
    }
    
    .nav-btn {
      border: none;
      background-color: transparent;
      cursor: pointer;
      font-size: 20px;
    }
    
    .open-btn {
      position: fixed;
      top: 10px;
      left: 10px;
    }
    
    .nav {
      position: fixed;
      top: 0;
      left: 0;
      height: 100vh;
      transform: translateX(-100%);
      transition: transform 0.3s ease-in-out;
    }
    
    .nav.visible {
      transform: translateX(0);
    }
    
    .nav-black {
      background-color: rgb(34, 31, 31);
      width: 60%;
      max-width: 480px;
      min-width: 320px;
      transition-delay: 0.4s;
    }
    
    .nav-black.visible {
      transition-delay: 0s;
    }
    
    .nav-red {
      background-color: rgb(229, 9, 20);
      width: 95%;
      transition-delay: 0.2s;
    }
    
    .nav-red.visible {
      transition-delay: 0.2s;
    }
    
    .nav-white {
      background-color: #fff;
      width: 95%;
      padding: 40px;
      position: relative;
      transition-delay: 0s;
    }
    
    .nav-white.visible {
      transition-delay: 0.4s;
    }
    
    .close-btn {
      opacity: 0.3;
      position: absolute;
      top: 40px;
      right: 30px;
    }
    
    .list {
      list-style-type: none;
      padding: 0;
    }
    
    .list li {
      margin: 20px 0;
    }
    
    .list li a {
      color: rgb(34, 31, 31);
      font-size: 14px;
      text-decoration: none;
      text-transform: uppercase;
    }
    
    .list ul {
      list-style-type: none;
      padding-left: 20px;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    const open_btn = document.querySelector('.open-btn')
    const close_btn = document.querySelector('.close-btn')
    const nav = document.querySelectorAll('.nav')
    
    open_btn.addEventListener('click', () => {
        nav.forEach(nav_el => nav_el.classList.add('visible'))
    })
    
    close_btn.addEventListener('click', () => {
        nav.forEach(nav_el => nav_el.classList.remove('visible'))
    })
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
  • 相关阅读:
    JavaScript中的map()方法详解
    TypeScript 数组
    【Leetcode】15. 三数之和
    qmake TEMPLATE subdirs
    windows/linux命令行操作快捷方式
    大数据随记 —— Scala 环境搭建、插件安装
    C++的一些关键字
    Python 考试练习题 1
    切方块游戏 HTML5+jQuery【附源码】
    Spring cloud properties与yml配置说明
  • 原文地址:https://blog.csdn.net/Im_print/article/details/126444446