diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-11-25 10:25:58 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-11-25 10:25:58 +0100 |
commit | 9bc89c24f5e0048b3138fec5293a968e19feca27 (patch) | |
tree | 78afc22f276291b395f0c65a906af4ea6579aa31 /theme/javascript/sidebar.js | |
parent | 5a8c4d5a4ed52e49c33cb6561502843b59950d36 (diff) | |
download | gitbook-9bc89c24f5e0048b3138fec5293a968e19feca27.zip gitbook-9bc89c24f5e0048b3138fec5293a968e19feca27.tar.gz gitbook-9bc89c24f5e0048b3138fec5293a968e19feca27.tar.bz2 |
Fix #1023: close sidebar after clicking a link on mobile
Diffstat (limited to 'theme/javascript/sidebar.js')
-rw-r--r-- | theme/javascript/sidebar.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/theme/javascript/sidebar.js b/theme/javascript/sidebar.js index d381822..9fc1e8e 100644 --- a/theme/javascript/sidebar.js +++ b/theme/javascript/sidebar.js @@ -25,9 +25,14 @@ function isOpen() { // Prepare sidebar: state and toggle button function init() { // Init last state if not mobile - if (!platform.isMobile) { + if (!platform.isMobile()) { toggleSidebar(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); + }); } // Filter summary with a list of path |