@@ -3,7 +3,7 @@ $.when($.ready).then(function() {
33
44 // Allow opening links in new tabs
55 if ( event . metaKey ) {
6- return
6+ return
77 }
88
99 // Prevent following link
@@ -25,8 +25,8 @@ $.when($.ready).then(function() {
2525 var nav = $ ( html ) . find ( '#nav' ) . html ( )
2626 var content = $ ( html ) . find ( '#content' ) . html ( )
2727
28- $ ( '#sidebar' ) . addClass ( " hidden" ) ;
29- $ ( '.js -close-sidebar ' ) . addClass ( " hidden" ) ;
28+ $ ( '#sidebar' ) . addClass ( ' hidden' )
29+ $ ( '#sidebar -close' ) . addClass ( ' hidden' )
3030
3131 // Update the page
3232 $ ( 'title' ) . text ( title )
@@ -38,21 +38,33 @@ $.when($.ready).then(function() {
3838
3939 // Add page load to brower history
4040 window . history . pushState ( {
41- " title" : title ,
42- " nav" : $ ( html ) . find ( '#nav' ) . html ( ) ,
43- " content" : $ ( html ) . find ( '#content' ) . html ( )
41+ ' title' : title ,
42+ ' nav' : $ ( html ) . find ( '#nav' ) . html ( ) ,
43+ ' content' : $ ( html ) . find ( '#content' ) . html ( )
4444 } , '' , href )
4545 } )
4646 } )
4747
4848 // Load page history (for back/forward nav)
4949 window . onpopstate = function ( e ) {
50- if ( e . state ) {
50+ if ( e . state ) {
5151
52- // Update the page
53- $ ( 'title' ) . text ( e . state . title )
54- $ ( '#nav' ) . html ( e . state . nav )
55- $ ( '#content' ) . html ( e . state . content )
56- }
52+ // Update the page
53+ $ ( 'title' ) . text ( e . state . title )
54+ $ ( '#nav' ) . html ( e . state . nav )
55+ $ ( '#content' ) . html ( e . state . content )
56+ }
5757 }
58+
59+ // Close sidebar (mobile)
60+ $ ( '#sidebar-close' ) . on ( 'click' , function ( ) {
61+ $ ( '#sidebar' ) . addClass ( 'hidden' )
62+ $ ( '#sidebar-close' ) . addClass ( 'hidden' )
63+ } )
64+
65+ // Show sidebar (mobile)
66+ $ ( '#sidebar-open' ) . on ( 'click' , function ( ) {
67+ $ ( '#sidebar' ) . removeClass ( 'hidden' )
68+ $ ( '#sidebar-close' ) . removeClass ( 'hidden' )
69+ } )
5870} )
0 commit comments