jquery兼容手机端移动端多级侧边栏弹出菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:jquery兼容手机端移动端多级侧边栏弹出菜单效果代码

代码标签: 移动 多级 侧边 弹出 菜单 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <style>
        html.hc-yscroll { overflow-y: scroll }
body.hc-nav-open { position: fixed; width: 100%; min-height: 100% }
.hc-mobile-nav { display: none; position: fixed; top: 0; height: 100%; z-index: 9999; overscroll-behavior: none }
.hc-mobile-nav.is-ios * { cursor: pointer !important }
.hc-mobile-nav .nav-container { position: fixed; z-index: 9998; top: 0; width: 240px; max-width: 100%; height: 100%; transition: transform .4s ease }
.hc-mobile-nav .nav-wrapper { width: 100% }
.hc-mobile-nav .nav-wrapper.nav-wrapper-1 { position: static; height: 100%; overflow: scroll; overflow-x: visible; overflow-y: auto }
.hc-mobile-nav ul { list-style: none; margin: 0; padding: 0 }
.hc-mobile-nav li { position: relative; display: block }
.hc-mobile-nav li.level-open>.nav-wrapper { visibility: visible }
.hc-mobile-nav input[type="checkbox"] { display: none }
.hc-mobile-nav label { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; cursor: pointer }
.hc-mobile-nav a { position: relative; display: block; box-sizing: border-box; cursor: pointer }
.hc-mobile-nav a,
.hc-mobile-nav a:hover { text-decoration: none }
.hc-mobile-nav.disable-body:not(.nav-open)::after { pointer-events: none }
.hc-mobile-nav.disable-body::after,
.hc-mobile-nav.disable-body .nav-wrapper::after { content: ''; position: fixed; z-index: 9990; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; overscroll-behavior: none; visibility: hidden; opacity: 0; transition: visibility 0s ease .4s, opacity .4s ease }
.hc-mobile-nav.disable-body.nav-open::after,
.hc-mobile-nav.disable-body .sub-level-open::after { visibility: visible; opacity: 1; transition-delay: .05s }
.hc-mobile-nav.nav-levels-expand .nav-wrapper::after { display: none }
.hc-mobile-nav.nav-levels-expand ul .nav-wrapper { min-width: 0; max-height: 0; overflow: hidden; transition: height 0s ease .4s }
.hc-mobile-nav.nav-levels-expand .level-open>.nav-wrapper { max-height: none }
.hc-mobile-nav.nav-levels-overlap ul .nav-wrapper { position: absolute; z-index: 9999; top: 0; height: 100%; visibility: hidden; transition: visibility 0s ease .4s, transform .4s ease }
.hc-mobile-nav.nav-levels-overlap ul ul { height: 100%; overflow: scroll; overflow-x: visible; overflow-y: auto }
.hc-mobile-nav.nav-levels-overlap ul li.nav-parent { position: static }
.hc-mobile-nav.nav-levels-overlap ul li.level-open>.nav-wrapper { visibility: visible; transition: transform .4s ease }
.hc-mobile-nav.side-left { left: 0 }
.hc-mobile-nav.side-left .nav-container { left: 0; transform: translate3d(-100%, 0, 0) }
.hc-mobile-nav.side-left.nav-levels-overlap li.level-open>.nav-wrapper { transform: translate3d(-40px, 0, 0) }
.hc-mobile-nav.side-left.nav-levels-overlap li .nav-wrapper { left: 0; transform: translate3d(-100%, 0, 0) }
.hc-mobile-nav.side-right { right: 0 }
.hc-mobile-nav.side-right .nav-container { right: 0; transform: translate3d(100%, 0, 0) }
.hc-mobile-nav.side-right.nav-levels-overlap li.level-open>.nav-wrapper { transform: translate3d(40px, 0, 0) }
.hc-mobile-nav.side-right.nav-levels-overlap li .nav-wrapper { right: 0; transform: translate3d(100%, 0, 0) }
.hc-mobile-nav.nav-open .nav-container { transform: translate3d(0, 0, 0) }
.hc-nav-trigger { position: absolute; cursor: pointer; display: none; top: 20px; z-index: 9980; min-height: 24px }
.hc-nav-trigger span { width: 30px; top: 50%; transform: translateY(-50%); transform-origin: 50% 50% }
.hc-nav-trigger span,
.hc-nav-trigger span::before,
.hc-nav-trigger span::after { position: absolute; left: 0; height: 4px; background: #34495E; transition: all .2s ease }
.hc-nav-trigger span::before,
.hc-nav-trigger span::after { content: ''; width: 100% }
.hc-nav-trigger span::before { top: -10px }
.hc-nav-trigger span::after { bottom: -10px }
.hc-nav-trigger.toggle-open span { background: rgba(0, 0, 0, 0); transform: rotate(45deg) }
.hc-nav-trigger.toggle-open span::before { transform: translate3d(0, 10px, 0) }
.hc-nav-trigger.toggle-open span::after { transform: rotate(-90deg) translate3d(10px, 0, 0) }
.hc-mobile-nav::after,
.hc-mobile-nav .nav-wrapper::after { background: rgba(0, 0, 0, 0.3) }
.hc-mobile-nav .nav-wrapper { background: #336ca6 }
.hc-mobile-nav.nav-open .nav-wrapper { box-shadow: 1px 0 2px rgba(0, 0, 0, 0.2) }
.hc-mobile-nav h2 { font-size: 19px; font-weight: normal; text-align: left; padding: 20px 17px; color: #1b3958 }
.hc-mobile-nav a { padding: 14px 17px; font-size: 15px; color: #fff; z-index: 1; background: rgba(0, 0, 0, 0); border-bottom: 1px solid #2c5d8f }
.hc-mobile-nav:not(.touch-device) a:hover { background: #31679e }
.hc-mobile-nav li { text-align: left }
.hc-mobile-nav li.nav-close a,
.hc-mobile-nav li.nav-back a { background: #2c5d8f; border-top: 1px solid #295887; border-bottom: 1px solid #295887 }
.hc-mobile-nav li.nav-close a:hover,
.hc-mobile-nav li.nav-back a:hover { background: #2b5c8d }
.hc-mobile-nav li.nav-parent a { padding-right: 58px }
.hc-mobile-nav li.nav-close span,
.hc-mobile-nav li.nav-parent span.nav-next,
.hc-mobile-nav li.nav-back span { width: 45px; position: absolute; top: 0; right: 0; bottom: 0; text-align: center; cursor: pointer; transition: background .2s ease }
.hc-mobile-nav li.nav-close span::before,
.hc-mobile-nav li.nav-close span::after { display: block; content: ''; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; margin-top: -3px; border-top: 2px solid #fff; border-left: 2px solid #fff }
.hc-mobile-nav li.nav-close span::before { margin-left: -9px; transform: rotate(135deg) }
.hc-mobile-nav li.nav-close span::after { transform: rotate(-45deg) }
.hc-mobile-nav a[href]:not([href="#"])>span.nav-next { border-left: 1px solid #2c5d8f }
.hc-mobile-nav span.nav-next::before,
.hc-mobile-nav li.nav-back span::before { content: ''; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin-left: -2px; box-sizing: border-box; border-top: 2px solid #fff; border-left: 2px solid #fff; transform-origin: center }
.hc-mobile-nav span.nav-next::before { transform: translate(-50%, -50%) rotate(135deg) }
.hc-mobile-nav li.nav-back span::before { transform: translate(-50%, -50%) rotate(-45deg) }
.hc-mobile-nav.side-right span.nav-next::before { margin-left: 0; margin-right: -2px; transform: translate(-50%, -50%) rotate(-45deg) }
.hc-mobile-nav.side-right li.nav-back span::before { margin-left: 0; margin-right: -2px; transform: translate(-50%, -50%) rotate(135deg) }
.hc-mobile-nav.nav-levels-expand .nav-container ul .nav-wrapper,
.hc-mobile-nav.nav-levels-none .nav-container ul .nav-wrapper { box-shadow: none; background: transparent }
.hc-mobile-nav.nav-levels-expand .nav-container ul h2,
.hc-mobile-nav.nav-levels-none .nav-container ul h2 { display: none }
.hc-mobile-nav.nav-levels-expand .nav-container ul ul a,
.hc-mobile-nav.nav-levels-none .nav-container ul ul a { font-size: 14px }
.hc-mobile-nav.nav-levels-expand .nav-container li,
.hc-mobile-nav.nav-levels-none .nav-container li { transition: background .3s ease }
.hc-mobile-nav.nav-levels-expand .nav-container li.level-open,
.hc-mobile-nav.nav-levels-none .nav-container li.level-open { background: #2e6296 }
.hc-mobile-nav.nav-levels-expand .nav-container li.level-open a,
.hc-mobile-nav.nav-levels-none .nav-container li.level-open a { border-bottom: 1px solid #295887 }
.hc-mobile-nav.nav-levels-expand .nav-container li.level-open a:hover,
.hc-mobile-nav.nav-levels-none .nav-container li.level-open a:hover { background: #2f649a }
.hc-mobile-nav.nav-levels-expand .nav-container li.level-open>a .nav-next::before,
.hc-mobile-nav.nav-levels-none .nav-container li.level-open>a .nav-next::before { margin-top: 2px; transform: translate(-50%, -50%) rotate(45deg) }
.hc-mobile-nav.nav-levels-expand .nav-container span.nav-next::before,
.hc-mobile-nav.nav-levels-none .nav-container span.nav-next::before { margin-top: -2px; transform: translate(-50%, -50%) rotate(225deg) }
html,
body,
div,
span,
header,
ul,
li,
a { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline }
html { height: 100% }
body { font-family: 'Raleway', sans-serif; text-align: center; color: #fffce1 }
h1,
h2,
h3,
h4,
h5,
h6 { margin: 0 }
em { font-style: italic }
strong { font-weight: 600 }
ol,
ul { list-style: none }
.cf::before,
.cf::after { content: ''; display: block; height: 0; overflow: hidden }
.cf::after { clear: both }
#container { display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; min-height: 100vh; height: 100%; background: linear-gradient(-134deg, #517FA4 0%, #243949 100%) }
.wrapper { max-width: 800px; margin: 0 auto; padding: 0 20px }
#main-nav { display: none }
header { position: relative; padding: 50px 0 20px }
header h1 { font-size: 50px; font-weight: 700; text-align: center; letter-spacing: 5px; padding-bottom: 8px }
header h2 { max-width: 680px; margin: auto; font-size: 20px; font-weight: 200; line-height: 1.4; text-align: center; letter-spacing: 1px; padding-bottom: 30px }
header .git { display: inline-block; text-decoration: none; color: #fff; border-radius: 4px; padding: 4px 10px 4px 0; font-size: 15px; font-weight: 400; color: #fffce1; background: #54b9cb; transition: background .15s ease-in-out }
header .git:hover { background: #4CA8B9 }
header .git:hover svg { border-color: #54b9cb }
header .git svg { width: 15px; height: 15px; fill: #fffce1; position: relative; top: 2px; padding: 0 10px; margin-right: 10px; border-right: 1px solid #4daabb; transition: border-color .15s ease-in-out }
header .toggle { position: absolute; cursor: pointer; display: none; top: 20px; z-index: 9980; min-height: 24px; position: relative; top: auto; left: auto; float: left; display: block; cursor: pointer; box-sizing: content-box; font-size: 20px; padding-left: 55px; line-height: 24px; margin-top: 55px }
header .toggle span { width: 35px; top: 50%; transform: translateY(-50%); transform-origin: 50% 50% }
header .toggle span,
header .toggle span::before,
header .toggle span::after { position: absolute; left: 0; height: 4px; background: #182631; transition: all .1s ease }
header .toggle span::before,
header .toggle span::after { content: ''; width: 100% }
header .toggle span::before { top: -10px }
header .toggle span::after { bottom: -10px }
header .toggle.toggle-open span { background: rgba(0, 0, 0, 0); transform: rotate(45deg) }
header .toggle.toggle-open span::before { transform: translate3d(0, 10px, 0) }
header .toggle.toggle-open span::after { transform: rotate(-90deg) translate3d(10px, 0, 0) }
header .toggle:hover span,
header .toggle:hover span::before,
header .toggle:hover span::after { background: #dab977 }
header .toggle div { display: inline-block; margin-right: 15px }
footer { padding-bottom: 40px }
footer .swm { display: inline-block; padding: 0 15px }
footer .swm svg { display: block; width: auto; height: 17px; margin-top: 22px }
footer .swm svg path { transition: fill .1s ease }
footer .swm:not(:hover) svg .l-1 { fill: #466e8d }
footer .swm:not(:hover) svg .l-2 { fill: #9db9cf }
footer .swm:not(:hover) svg .l-3 { fill: #5989ad }


main { -ms-flex: 1 0 auto; flex: 1 0 auto; padding-bottom: 30px; text-align: left }
main .content { border-top: 1px solid rgba(255, 255, 255, 0.1) }
main h4 { font-size: 15px; letter-spacing: 1px; font-weight: 600; text-transform: uppercase; margin: 20px 0 }
main h4:first-child { margin-top: 30px }
main .actions { margin: 0 -15px; text-align: center }
main .actions div { padding: 0 15px 20px; box-sizing: border-box }

@media screen and (min-width: 800px) { 
 main .actions { display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap   } 
 main .actions div { float: left; -ms-flex: 1 1 33.33%; flex: 1 1 33.33%; max-width: 33.33% }
}

main .button { position: relative; display: block; padding: 18px 30px 16px; text-transform: uppercase; text-align: center; font-size: 16px; font-weight: 700; line-height: 1.4; letter-spacing: 1px; text-decoration: none; color: #243949; cursor: pointer; background: #fffce1; border-radius: 30px/80px; transition: all .1s ease-out }
main .button:not(.active):hover { color: #d5af63 }
main .button.active { background: #dab977 }




.hc-mobile-nav .nav-container { width: 280px }
.hc-mobile-nav h2 { font-weight: 400 }
.hc-mobile-nav a { font-size: 16px }
.hc-mobile-nav li.cryptocurrency>a::before { font-family: 'Material Icons'; font-weight: normal; font-style: normal; display: inline-block; line-height: 1; text-transform: none; text-indent: 0; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; display: inline-block; width: 19px; height: 19px; margin-right: 15px; font-size: 19px; vertical-align: top; content: '' }
.hc-mobile-nav li.devices>a::before { font-family: 'Material Icons'; font-weight: normal; font-style: normal; display: inline-block; line-height: 1; text-transform: none; text-indent: 0; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; display: inline-block; width: 19px; height: 19px; margin-right: 15px; font-size: 19px; vertical-align: top; content: '' }
.hc-mobile-nav li.mobile>a::before { font-family: 'Material Icons'; font-weight: normal; font-style: normal; display: inline-block; line-height: 1; text-transform: none; text-indent: 0; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; display: inline-block; width: 19px; height: 19px; margin-right: 15px; font-size: 19px; vertical-align: top; content: '' }
.hc-mobile-nav li.television>a::before { font-family: 'Material Icons'; font-weight: normal; font-style: n.........完整代码请登录后点击上方下载按钮下载查看

网友评论0