現代都市風 移動端可摺疊導航菜單

来源:https://www.cnblogs.com/chenyingying0/archive/2020/05/08/12851759.html
-Advertisement-
Play Games

效果圖 index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>index</title> <link rel="stylesheet" href="https://fonts.googleap ...


效果圖

 

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700">
    <link rel="stylesheet" href="css/style.css">
</head>

<body>

<div class="htmleaf-container">
    <div id="wrapper">

    <!-- 菜單 -->    
    <div class="menu">
        <img id="menu-bg" src="images/golden-gate-lights.jpg" />
        <ul>
            <li><a href="">About</a></li>
            <li><a href="">Share</a></li>
            <li><a href="">Activity</a></li>
            <li><a href="">Settings</a></li>
            <li><a href="">Contact</a></li>
        </ul>
    </div>

    <div class="screen">
        <div class="navbar"></div>
        <div class="list">
            <div class="item">
                <div class="img"></div>
                <span></span>
                <span></span>
                <span></span>
            </div>
            <div class="item">
                <div class="img"></div>
                <span></span>
                <span></span>
                <span></span>
            </div>
            <div class="item">
                <div class="img"></div>
                <span></span>
                <span></span>
                <span></span>
            </div>
            <div class="item">
                <div class="img"></div>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
        <div class="burger">
            <div class="x"></div>
            <div class="y"></div>
            <div class="z"></div>
        </div>
    </div>

    </div>
</div>

<script src='https://libs.baidu.com/jquery/1.10.2/jquery.min.js'></script>
<script src='js/script.js'></script>
</body>
</html>

style.css

/*basic*/
@import "https://fonts.googleapis.com/css?family=Raleway:200,500,700,800";
  @font-face {
  font-family:icomoon;
  src:url(../fonts/icomoon.eot?rretjt);
  src:url(../fonts/icomoon.eot?#iefixrretjt) format('embedded-opentype'),
      url(../fonts/icomoon.woff?rretjt) format('woff'),
      url(../fonts/icomoon.ttf?rretjt) format('truetype'),
      url(../fonts/icomoon.svg?rretjt#icomoon) format('svg');
  font-weight:400;
  font-style:normal
}
[class^=icon-],[class*=" icon-"] {
  font-family:icomoon;
  speak:none;
  font-style:normal;
  font-weight:400;
  font-variant:normal;
  text-transform:none;
  line-height:1;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale
}
body,html {
  font-size:100%;
  padding:0;
  margin:0
}
*,*:after,*:before {
  -webkit-box-sizing:border-box;
  -moz-box-sizing:border-box;
  box-sizing:border-box
}
.clearfix:before,.clearfix:after {
  content:" ";
  display:table
}
.clearfix:after {
  clear:both
}
body {
  background:#f9f7f6;
  color:#404d5b;
  font-weight:500;
  font-size:1.05em;
  font-family:segoe ui,lucida grande,Helvetica,Arial,microsoft yahei,FreeSans,Arimo,droid sans,wenquanyi micro hei,hiragino sans gb,hiragino sans gb w3,fontawesome,sans-serif
}
a {
  color:#2fa0ec;
  text-decoration:none;
  outline:none
}
a:hover,a:focus {
  color:#74777b
}
.htmleaf-container {
  margin:0 auto;
  text-align:center;
  overflow:hidden
}
.htmleaf-content {
  font-size:150%;
  padding:1em 0
}
.htmleaf-content h2 {
  margin:0 0 2em;
  opacity:.1
}
.htmleaf-content p {
  margin:1em 0;
  padding:5em 0 0;
  font-size:.65em
}
.bgcolor-1 {
  background:#f0efee
}
.bgcolor-2 {
  background:#f9f9f9
}
.bgcolor-3 {
  background:#e8e8e8
}
.bgcolor-4 {
  background:#2f3238;
  color:#fff
}
.bgcolor-5 {
  background:#df6659;
  color:#521e18
}
.bgcolor-6 {
  background:#2fa8ec
}
.bgcolor-7 {
  background:#d0d6d6
}
.bgcolor-8 {
  background:#3d4444;
  color:#fff
}
.bgcolor-9 {
  background:#ef3f52;
  color:#fff
}
.bgcolor-10 {
  background:#64448f;
  color:#fff
}
.bgcolor-11 {
  background:#3755ad;
  color:#fff
}
.bgcolor-12 {
  background:#3498db;
  color:#fff
}
.htmleaf-header {
  padding:1em 190px;
  letter-spacing:-1px;
  text-align:center
}
.htmleaf-header h1 {
  color:#fff;
  font-weight:600;
  font-size:2em;
  line-height:1;
  margin-bottom:0;
  font-family:segoe ui,lucida grande,Helvetica,Arial,microsoft yahei,FreeSans,Arimo,droid sans,wenquanyi micro hei,hiragino sans gb,hiragino sans gb w3,fontawesome,sans-serif
}
.htmleaf-header h1 span {
  font-family:segoe ui,lucida grande,Helvetica,Arial,microsoft yahei,FreeSans,Arimo,droid sans,wenquanyi micro hei,hiragino sans gb,hiragino sans gb w3,fontawesome,sans-serif;
  display:block;
  font-size:60%;
  font-weight:400;
  padding:.8em 0 .5em;
  color:#c3c8cd
}
.htmleaf-demo a {
  color:#1d7db1;
  text-decoration:none
}
.htmleaf-demo {
  width:100%;
  padding-bottom:1.2em
}
.htmleaf-demo a {
  display:inline-block;
  margin:.5em;
  padding:.6em 1em;
  border:3px solid #1d7db1;
  font-weight:700
}
.htmleaf-demo a:hover {
  opacity:.6
}
.htmleaf-demo a.current {
  background:#1d7db1;
  color:#fff
}
.htmleaf-links {
  position:relative;
  display:inline-block;
  white-space:nowrap;
  font-size:1.5em;
  text-align:center
}
.htmleaf-links::after {
  position:absolute;
  top:0;
  left:50%;
  margin-left:-1px;
  width:2px;
  height:100%;
  background:#dbdbdb;
  content:'';
  -webkit-transform:rotate3d(0,0,1,22.5deg);
  transform:rotate3d(0,0,1,22.5deg)
}
.htmleaf-icon {
  display:inline-block;
  margin:.5em;
  padding:0 0;
  width:1.5em;
  text-decoration:none
}
.htmleaf-icon span {
  display:none
}
.htmleaf-icon:before {
  margin:0 5px;
  text-transform:none;
  font-weight:400;
  font-style:normal;
  font-variant:normal;
  font-family:icomoon;
  line-height:1;
  speak:none;
  -webkit-font-smoothing:antialiased
}
.htmleaf-footer {
  width:100%;
  padding-top:10px
}
.htmleaf-small {
  font-size:.8em
}
.center {
  text-align:center
}
.related {
  position:absolute;
  top:100%;
  left:0;
  width:100%;
  color:#fff;
  background:#333;
  text-align:center;
  font-size:1.25em;
  padding:.5em 0;
  overflow:hidden
}
.related>a {
  vertical-align:top;
  width:calc(100% - 20px);
  max-width:340px;
  display:inline-block;
  text-align:center;
  margin:20px 10px;
  padding:25px;
  font-family:segoe ui,lucida grande,Helvetica,Arial,microsoft yahei,FreeSans,Arimo,droid sans,wenquanyi micro hei,hiragino sans gb,hiragino sans gb w3,fontawesome,sans-serif
}
.related a {
  display:inline-block;
  text-align:left;
  margin:20px auto;
  padding:10px 20px;
  opacity:.8;
  -webkit-transition:opacity .3s;
  transition:opacity .3s;
  -webkit-backface-visibility:hidden
}
.related a:hover,.related a:active {
  opacity:1
}
.related a img {
  max-width:100%;
  opacity:.8;
  border-radius:4px
}
.related a:hover img,.related a:active img {
  opacity:1
}
.related h3 {
  font-family:microsoft yahei,sans-serif
}
.related a h3 {
  font-weight:300;
  margin-top:.15em;
  color:#fff
}
.icon-htmleaf-home-outline:before {
  content:"\e5000"
}
.icon-htmleaf-arrow-forward-outline:before {
  content:"\e5001"
}
@media screen and (max-width:50em) {
  .htmleaf-header {
  padding:3em 10% 4em
}
.htmleaf-header h1 {
  font-size:2em
}
}@media screen and (max-width:40em) {
  .htmleaf-header h1 {
  font-size:1.5em
}
}@media screen and (max-width:30em) {
  .htmleaf-header h1 {
  font-size:1.2em
}
}

/*demo1*/
* {
  margin:0;
  padding:0
}
body {
  background:#383c55;
  width:100%;
  height:100%;
  font:12px open sans,sans-serif
}
#wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: absolute;
  background: #111;
}
div.screen {
  width: 100%;
  height: 100%;
  overflow:hidden;
  position:absolute;
  top:0;
  left:0;
  background:#31558a;
  -webkit-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 500ms cubic-bezier(0,.995,.99,1);
  transition:all 500ms cubic-bezier(0,.995,.99,1)
}
div.screen.animate {
  left:80%;
  -webkit-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 500ms cubic-bezier(0,.995,.99,1);
  transition:all 500ms cubic-bezier(0,.995,.99,1)
}
.list {
  margin-top: 100px;
  text-align: left;
}
.item {
  height: 328px;
  padding-left: 182px;
  clear: both;
}
.item .img,.item span {
  background:#214273;
  border-radius:3px
}
.item .img {
  float: left;
  width: 200px;
  height: 200px;
  margin-left: -93px;
}
.item span {
  height: 30px;
  width: 62%;
  margin-bottom: 48px;
  margin-left: 9%;
  float: left;
}
.item span:nth-of-type(3) {
  width:75px;
  margin-botom:0
}
div.burger {
  height: 100px;
  width: 100px;
  position: absolute;
  top: 11px;
  left: 50px;
  cursor: pointer;
}
div.x,div.y,div.z {
  position:absolute;
  margin:auto;
  top:0;
  bottom:0;
  background:#fff;
  border-radius:2px;
  -webkit-transition:all 200ms ease-out;
  -moz-transition:all 200ms ease-out;
  -ms-transition:all 200ms ease-out;
  -o-transition:all 200ms ease-out;
  transition:all 200ms ease-out
}
div.x,div.y,div.z {
  height: 10px;
  width: 60px;
  -webkit-transition:all 100ms ease-out;
  -moz-transition:all 100ms ease-out;
  -ms-transition:all 100ms ease-out;
  -o-transition:all 100ms ease-out;
  transition:all 100ms ease-out
}
div.y.squize {
  width:0;
  -webkit-transition:all 100ms ease-out;
  -moz-transition:all 100ms ease-out;
  -ms-transition:all 100ms ease-out;
  -o-transition:all 100ms ease-out;
  transition:all 100ms ease-out
}
div.y {
  top:39px;
}
div.z {
  top:80px;
}
div.open div.x,div.open div.z {
  top:19px;
  -webkit-transition:all 70ms ease-out;
  -moz-transition:all 70ms ease-out;
  -ms-transition:all 70ms ease-out;
  -o-transition:all 70ms ease-out;
  transition:all 70ms ease-out
}
div.rotate30 {
  -ms-transform:rotate(30deg);
  -webkit-transform:rotate(30deg);
  transform:rotate(30deg);
  -webkit-transition:all 70ms ease-out;
  -moz-transition:all 70ms ease-out;
  -ms-transition:all 70ms ease-out;
  -o-transition:all 70ms ease-out;
  transition:all 70ms ease-out
}
div.rotate150 {
  -ms-transform:rotate(150deg);
  -webkit-transform:rotate(150deg);
  transform:rotate(150deg);
  -webkit-transition:all 70ms ease-out;
  -moz-transition:all 70ms ease-out;
  -ms-transition:all 70ms ease-out;
  -o-transition:all 70ms ease-out;
  transition:all 70ms ease-out
}
div.rotate45 {
  -ms-transform:rotate(45deg);
  -webkit-transform:rotate(45deg);
  transform:rotate(45deg);
  -webkit-transition:all 100ms ease-out;
  -moz-transition:all 100ms ease-out;
  -ms-transition:all 100ms ease-out;
  -o-transition:all 100ms ease-out;
  transition:all 100ms ease-out
}
div.rotate135 {
  -ms-transform:rotate(135deg);
  -webkit-transform:rotate(135deg);
  transform:rotate(135deg);
  -webkit-transition:all 100ms ease-out;
  -moz-transition:all 100ms ease-out;
  -ms-transition:all 100ms ease-out;
  -o-transition:all 100ms ease-out;
  transition:all 100ms ease-out
}
div.navbar {
  height:200px;
  background:#385e97
}
div.menu {
  height:568px;
  width:320px;
  margin-left:-190px;
  opacity:0;
  position:relative;
  -webkit-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 500ms cubic-bezier(0,.995,.99,1);
  transition:all 500ms cubic-bezier(0,.995,.99,1)
}
#menu-bg {
  position:absolute;
  left:-10px;
  top:-120px;
  opacity:.3;
  -webkit-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 500ms cubic-bezier(0,.995,.99,1);
  transition:all 500ms cubic-bezier(0,.995,.99,1)
}
div.menu.animate #menu-bg {
  width: 350%;
  left: -143px;
  -webkit-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 500ms cubic-bezier(0,.995,.99,1);
  transition:all 500ms cubic-bezier(0,.995,.99,1)
}
div.menu.animate {
  width:100%;
  margin-left: -110px;
  opacity: 1;
  -webkit-transition: all 500ms cubic-bezier(0,.995,.99,1);
  -moz-transition: all 500ms cubic-bezier(0,.995,.99,1);
  -ms-transition: all 500ms cubic-bezier(0,.995,.99,1);
  -o-transition: all 500ms cubic-bezier(0,.995,.99,1);
  transition: all 500ms cubic-bezier(0,.995,.99,1);
}
div.menu ul {
  position: relative;
  padding-top: 200px;
}
div.menu ul li {
  list-style: none;
  width: 100%;
  margin-top: 120px;
  text-align: left;
  padding-left: 300px;
  font-size: 50px;
}
div.menu ul li a {
  color:#fff;
  text-decoration:none;
  letter-spacing:1px
}
div.menu.animate ul li {
  margin-left: 80px;
  -webkit-transition:all 800ms cubic-bezier(0,.995,.99,1);
  -moz-transition:all 800ms cubic-bezier(0,.995,.99,1);
  -ms-transition:all 800ms cubic-bezier(0,.995,.99,1);
  -o-transition:all 800ms cubic-bezier(0,.995,.99,1);
  transition:all 800ms cubic-bezier(0,.995,.99,1)
}
div.menu.animate li:nth-of-type(1) {
  transition-delay:0s
}
div.menu.animate li:nth-of-type(2) {
  transition-delay:.06s
}
div.menu.animate li:nth-of-type(3) {
  transition-delay:.12s
}
div.menu.animate li:nth-of-type(4) {
  transition-delay:.18s
}
div.menu.animate li:nth-of-type(5) {
  transition-delay:.24s
}

script.js

$(document).ready(function() {
    if ('ontouchstart' in window) {
        var click = 'touchstart';
    } else {
        var click = 'click';
    }
    $('div.burger').on(click, function () {
        if (!$(this).hasClass('open')) {
            openMenu();
        } else {
            closeMenu();
        }
    });
    $('div.menu ul li a').on(click, function (e) {
        e.preventDefault();
        closeMenu();
    });
    function openMenu() {
        $('div.burger').addClass('open');
        $('div.y').fadeOut(100);
        $('div.screen').addClass('animate');
        setTimeout(function () {
            $('div.x').addClass('rotate30');
            $('div.z').addClass('rotate150');
            $('.menu').addClass('animate');
            setTimeout(function () {
                $('div.x').addClass('rotate45');
                $('div.z').addClass('rotate135');
            }, 100);
        }, 10);
    }
    function closeMenu() {
        $('div.screen, .menu').removeClass('animate');
        $('div.y').fadeIn(150);
        $('div.burger').removeClass('open');
        $('div.x').removeClass('rotate45').addClass('rotate30');
        $('div.z').removeClass('rotate135').addClass('rotate150');
        setTimeout(function () {
            $('div.x').removeClass('rotate30');
            $('div.z').removeClass('rotate150');
        }, 50);
        setTimeout(function () {
            $('div.x, div.z').removeClass('collapse');
        }, 70);
    }
});

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 背景: 想要實現圖片持續滾動,既然使用js,就千萬不要加css動畫、過渡等相關樣式,如果想要滾動的平滑一下,可以一像素一像素的感動,則很平滑,如果加了過渡動畫,當圖片重置為0時,會有往回倒的動畫效果,跟預期不符。 原理: 圖片滾動原理同圖片輪播原理,同樣也適用於文字滾動等一系列滾動,通過複製最後一張 ...
  • Math常用方法 方法名功能 abs(x) 返回 x 的絕對值。 ceil(x) 對數進行上舍入。 floor(x) 對 x 進行下舍入。 max(x,y,z,...,n) 返回 x,y,z,...,n 中的最高值。 min(x,y,z,...,n) 返回 x,y,z,...,n中的最低值。 pow ...
  • // 數值補零 function createZero(n){ if(n<10){ return "0"+n; } return n; } //字元補零 function createZero(n){ if(n.length < 2){ return "0" + n } return n; } fu ...
  • # 引入jQuery工具庫 ## 下載地址 - cdn:http://www.jq22.com/cdn/#a2 - 下載地址:http://www.jq22.com/jquery-info122 # 文檔查詢 - 中文:https://www.jquery123.com/ - 英文:https:// ...
  • // var num = 234; // console.log(num); // var er = num.toString(2); // console.log(er); // var ba = num.toString(8); // console.log(ba); // var sl = n ...
  • //random() 方法可返回介於 0 ~ 1 之間的一個隨機數。 //生成最小min到最大max的隨機數 function random(min,max){ if(min > max){ var ls = min; min = max; max = ls; } return Math.floor ...
  • function getMax(abc){ // 1.要深拷貝數組 abc = abc.slice(0); // 2.排序(升序第一個值是最小值,降序第一個值是最大值) abc.sort(function(a,b){return b-a}); // 3.返回第一個值 return abc[0]; } ...
  • 1、電腦安裝Chrome瀏覽器,最後步驟註意《打開開發者模式》,把解壓的文件夾直接拖到最後的頁面,谷歌訪問助手雲盤鏈接: https://pan.baidu.com/s/1xney03jULcmBtemolgh_qQ 提取碼: w9ah (永久有效) ...
一周排行
    -Advertisement-
    Play Games
  • 新改進提供的Taurus Rpc 功能,可以簡化微服務間的調用,同時可以不用再手動輸出模塊名稱,或調用路徑,包括負載均衡,這一切,由框架實現並提供了。新的Taurus Rpc 功能,將使得服務間的調用,更加輕鬆、簡約、高效。 ...
  • 本章將和大家分享ES的數據同步方案和ES集群相關知識。廢話不多說,下麵我們直接進入主題。 一、ES數據同步 1、數據同步問題 Elasticsearch中的酒店數據來自於mysql資料庫,因此mysql數據發生改變時,Elasticsearch也必須跟著改變,這個就是Elasticsearch與my ...
  • 引言 在我們之前的文章中介紹過使用Bogus生成模擬測試數據,今天來講解一下功能更加強大自動生成測試數據的工具的庫"AutoFixture"。 什麼是AutoFixture? AutoFixture 是一個針對 .NET 的開源庫,旨在最大程度地減少單元測試中的“安排(Arrange)”階段,以提高 ...
  • 經過前面幾個部分學習,相信學過的同學已經能夠掌握 .NET Emit 這種中間語言,並能使得它來編寫一些應用,以提高程式的性能。隨著 IL 指令篇的結束,本系列也已經接近尾聲,在這接近結束的最後,會提供幾個可供直接使用的示例,以供大伙分析或使用在項目中。 ...
  • 當從不同來源導入Excel數據時,可能存在重覆的記錄。為了確保數據的準確性,通常需要刪除這些重覆的行。手動查找並刪除可能會非常耗費時間,而通過編程腳本則可以實現在短時間內處理大量數據。本文將提供一個使用C# 快速查找並刪除Excel重覆項的免費解決方案。 以下是實現步驟: 1. 首先安裝免費.NET ...
  • C++ 異常處理 C++ 異常處理機制允許程式在運行時處理錯誤或意外情況。它提供了捕獲和處理錯誤的一種結構化方式,使程式更加健壯和可靠。 異常處理的基本概念: 異常: 程式在運行時發生的錯誤或意外情況。 拋出異常: 使用 throw 關鍵字將異常傳遞給調用堆棧。 捕獲異常: 使用 try-catch ...
  • 優秀且經驗豐富的Java開發人員的特征之一是對API的廣泛瞭解,包括JDK和第三方庫。 我花了很多時間來學習API,尤其是在閱讀了Effective Java 3rd Edition之後 ,Joshua Bloch建議在Java 3rd Edition中使用現有的API進行開發,而不是為常見的東西編 ...
  • 框架 · 使用laravel框架,原因:tp的框架路由和orm沒有laravel好用 · 使用強制路由,方便介面多時,分多版本,分文件夾等操作 介面 · 介面開發註意欄位類型,欄位是int,查詢成功失敗都要返回int(對接java等強類型語言方便) · 查詢介面用GET、其他用POST 代碼 · 所 ...
  • 正文 下午找企業的人去鎮上做貸後。 車上聽同事跟那個司機對罵,火星子都快出來了。司機跟那同事更熟一些,連我在內一共就三個人,同事那一手指桑罵槐給我都聽愣了。司機也是老社會人了,馬上聽出來了,為那個無辜的企業經辦人辯護,實際上是為自己辯護。 “這個事情你不能怪企業。”“但他們總不能讓銀行的人全權負責, ...
  • 1. JUnit 最佳實踐指南 原文: https://howtodoinjava.com/best-practices/unit-testing-best-practices-junit-reference-guide/ 我假設您瞭解 JUnit 的基礎知識。 如果您沒有基礎知識,請首先閱讀(已針 ...