Showing
3 changed files
with
18 additions
and
10 deletions
@@ -31,7 +31,7 @@ lazyLoad($('img.lazy')); | @@ -31,7 +31,7 @@ lazyLoad($('img.lazy')); | ||
31 | $('.nav-btn').on('tap', function (event) { | 31 | $('.nav-btn').on('tap', function (event) { |
32 | if (!$(this).hasClass('menu-open')) { | 32 | if (!$(this).hasClass('menu-open')) { |
33 | $('.mobile-wrap').addClass('menu-open'); | 33 | $('.mobile-wrap').addClass('menu-open'); |
34 | - $('.overlay').addClass('show'); | 34 | + $('.overlay').show().css('opacity', 0.3); |
35 | $('.side-nav').addClass('on'); | 35 | $('.side-nav').addClass('on'); |
36 | 36 | ||
37 | //设置boy高宽,页面不能上下滑动 | 37 | //设置boy高宽,页面不能上下滑动 |
@@ -48,13 +48,16 @@ $('.nav-btn').on('tap', function (event) { | @@ -48,13 +48,16 @@ $('.nav-btn').on('tap', function (event) { | ||
48 | $('.mobile-wrap').on('tap', function () { | 48 | $('.mobile-wrap').on('tap', function () { |
49 | if ($(this).hasClass('menu-open')) { | 49 | if ($(this).hasClass('menu-open')) { |
50 | $('.mobile-wrap').removeClass('menu-open'); | 50 | $('.mobile-wrap').removeClass('menu-open'); |
51 | - $('.overlay').removeClass('show'); | 51 | + $('.overlay').css('opacity', 0); |
52 | $('.sub-nav').removeClass('show'); | 52 | $('.sub-nav').removeClass('show'); |
53 | $('.side-nav').removeClass('on'); | 53 | $('.side-nav').removeClass('on'); |
54 | $('body').css({ | 54 | $('body').css({ |
55 | height: 'auto', | 55 | height: 'auto', |
56 | overflow: 'auto' | 56 | overflow: 'auto' |
57 | }); | 57 | }); |
58 | + setTimeout(function() { | ||
59 | + $('.overlay').hide(); | ||
60 | + }, 300); | ||
58 | } | 61 | } |
59 | }); | 62 | }); |
60 | 63 |
@@ -10,12 +10,11 @@ | @@ -10,12 +10,11 @@ | ||
10 | position: relative; | 10 | position: relative; |
11 | z-index: 2; | 11 | z-index: 2; |
12 | background: #f0f0f0; | 12 | background: #f0f0f0; |
13 | - @include transition(transform .3s); | 13 | + @include transition(transform .3s ease-out); |
14 | } | 14 | } |
15 | 15 | ||
16 | .mobile-wrap.menu-open { | 16 | .mobile-wrap.menu-open { |
17 | @include transform(translateX(540rem / $pxConvertRem)); | 17 | @include transform(translateX(540rem / $pxConvertRem)); |
18 | - @include transition(transform .3s); | ||
19 | } | 18 | } |
20 | 19 | ||
21 | 20 | ||
@@ -27,10 +26,12 @@ | @@ -27,10 +26,12 @@ | ||
27 | right: 0; | 26 | right: 0; |
28 | bottom: 0; | 27 | bottom: 0; |
29 | background: #000; | 28 | background: #000; |
30 | - opacity: 0.3; | 29 | + opacity: 0; |
31 | z-index: 99; | 30 | z-index: 99; |
31 | + @include transition(opacity 1s); | ||
32 | } | 32 | } |
33 | 33 | ||
34 | .overlay.show { | 34 | .overlay.show { |
35 | display: block; | 35 | display: block; |
36 | + opacity: 0.3; | ||
36 | } | 37 | } |
1 | .side-nav { | 1 | .side-nav { |
2 | - display: none; | 2 | + // display: none; |
3 | background: #fff; | 3 | background: #fff; |
4 | position: fixed; | 4 | position: fixed; |
5 | top: 0; | 5 | top: 0; |
@@ -8,6 +8,8 @@ | @@ -8,6 +8,8 @@ | ||
8 | left: 0; | 8 | left: 0; |
9 | z-index: 1; | 9 | z-index: 1; |
10 | overflow: hidden; | 10 | overflow: hidden; |
11 | + @include transform(translateX(-540rem / $pxConvertRem)); | ||
12 | + @include transition(all .3s ease-out); | ||
11 | 13 | ||
12 | ul { | 14 | ul { |
13 | background: #f0f0f0; | 15 | background: #f0f0f0; |
@@ -103,20 +105,22 @@ | @@ -103,20 +105,22 @@ | ||
103 | } | 105 | } |
104 | 106 | ||
105 | .side-nav.on { | 107 | .side-nav.on { |
106 | - display: block; | 108 | + // display: block; |
109 | + @include transform(translateX(0rem / $pxConvertRem)); | ||
107 | } | 110 | } |
108 | 111 | ||
109 | .sub-nav { | 112 | .sub-nav { |
113 | + // display: none; | ||
110 | position: fixed; | 114 | position: fixed; |
111 | top: 0; | 115 | top: 0; |
112 | right: 100rem / $pxConvertRem; | 116 | right: 100rem / $pxConvertRem; |
113 | left: 0; | 117 | left: 0; |
114 | bottom: 0; | 118 | bottom: 0; |
119 | + width: 100%; | ||
115 | background: #fff !important; | 120 | background: #fff !important; |
116 | - z-index: 2; | ||
117 | - | ||
118 | - @include transform(translateX(100%)); | 121 | + // z-index: 2; |
119 | 122 | ||
123 | + @include transform(translateX(540rem / $pxConvertRem)); | ||
120 | @include transition(transform 0.3s); | 124 | @include transition(transform 0.3s); |
121 | 125 | ||
122 | li { | 126 | li { |
-
Please register or login to post a comment