mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 01:25:16 +00:00
Fix #1023: close sidebar after clicking a link on mobile
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
module.exports = {
|
||||
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
|
||||
isMobile: function() {
|
||||
return (document.width <= 600);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user