File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -7,17 +7,22 @@ const title = dom.$.title
7
7
* Toggle button
8
8
*/
9
9
export function btn ( el ) {
10
- const toggle = ( ) => dom . body . classList . toggle ( 'close' )
10
+ const toggle = _ => dom . body . classList . toggle ( 'close' )
11
11
12
12
el = dom . getNode ( el )
13
- dom . on ( el , 'click' , toggle )
13
+ dom . on ( el , 'click' , e => {
14
+ e . stopPropagation ( )
15
+ toggle ( )
16
+ } )
14
17
15
18
const sidebar = dom . getNode ( '.sidebar' )
16
19
17
- dom . on ( sidebar , 'click' , ( ) => {
18
- isMobile && toggle ( )
19
- setTimeout ( ( ) => getAndActive ( sidebar , true , true ) , 0 )
20
- } )
20
+ isMobile && dom . on ( dom . body , 'click' , _ =>
21
+ dom . body . classList . contains ( 'close' ) && toggle ( )
22
+ )
23
+ dom . on ( sidebar , 'click' , _ =>
24
+ setTimeout ( ( _ => getAndActive ( sidebar , true , true ) , 0 ) )
25
+ )
21
26
}
22
27
23
28
export function sticky ( ) {
You can’t perform that action at this time.
0 commit comments