src/js/theme/sidebar.js
function init() {
    // Init last state if not mobile
    if (!platform.isMobile()) {
        toggleSidebar(gitbook.storage.get('sidebar', true), false);
    }

    // Close sidebar after clicking a link on mobile
    $(document).on('click', '.book-summary li.chapter a', function(e) {
        if (platform.isMobile()) toggleSidebar(false, false);
    });
}
function init() {
    // Init last state if not mobile
    if (!platform.isMobile()) {
        toggleSidebar(gitbook.storage.get('sidebar', true), false);
    }

    // Close sidebar after clicking a link on mobile
    $(document).on('click', '.book-summary li.chapter a', function(e) {
        if (platform.isMobile()) toggleSidebar(false, false);
    });
}
function init ( ) { // Init last state if not mobile if ( ! platform . isMobile ( ) ) { toggleSidebar ( gitbook . storage . get ( 'sidebar' , true ) , false ) ; } // Close sidebar after clicking a link on mobile $ ( document ) . on ( 'click' , '.book-summary li.chapter a' , function ( e ) { if ( platform . isMobile ( ) ) toggleSidebar ( false , false ) ; } ) ; }
Prepare sidebar: state and toggle button
Prepare sidebar : state and toggle button