summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortcorral <amischol@gmail.com>2014-04-13 04:24:07 +0200
committertcorral <amischol@gmail.com>2014-04-13 04:24:07 +0200
commit646a4513e332987bffac54e8e37e086a4031a3e0 (patch)
tree2d5f2a3137d854947b45eb56f6456a408f1f989b
parentd9e34fc671b3502e96a933afd3ac7c5a5cafab0f (diff)
downloadgitbook-646a4513e332987bffac54e8e37e086a4031a3e0.zip
gitbook-646a4513e332987bffac54e8e37e086a4031a3e0.tar.gz
gitbook-646a4513e332987bffac54e8e37e086a4031a3e0.tar.bz2
Allow scroll in computers that put the navigation over scroll control. When the document is ready it will check the difference between the body-inner and the page-wrapper width to move the layer only this width allowing the user to scroll.
-rw-r--r--theme/javascript/app.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js
index d877c53..eba2f56 100644
--- a/theme/javascript/app.js
+++ b/theme/javascript/app.js
@@ -12,8 +12,16 @@ require([
"core/sidebar",
"core/search"
], function($, storage, analytic, sharing, state, keyboard, exercise, quiz, progress, sidebar, search){
+ function changeNavigationPosition()
+ {
+ var bodyInnerWidth, pageWrapperWidth;
+ bodyInnerWidth = parseInt($('.body-inner').css('width'), 10);
+ pageWrapperWidth = parseInt($('.page-wrapper').css('width'), 10);
+ $('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
+ }
+ $(window).on('resize', changeNavigationPosition);
$(document).ready(function() {
- var $book, bodyInnerWidth, pageWrapperWidth;
+ var $book;
$book = state.$book;
// Init sidebar
@@ -51,8 +59,6 @@ require([
$(".book-body").focus();
// Move, if needed, right navigation control to allow scrolling.
- bodyInnerWidth = parseInt($('.body-inner').css('width'), 10);
- pageWrapperWidth = parseInt($('.page-wrapper').css('width'), 10);
- $('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
+ changeNavigationPosition();
});
});