diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-14 16:44:11 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-14 16:44:11 +0200 |
commit | 1b147d3e302046c1bb613332a2c0c18f7d8b21a0 (patch) | |
tree | 111156197a463b82373cc79656e85adf482199f8 /theme/javascript | |
parent | 5848f5db51fb9258ff55dc93010b2c862abeec0a (diff) | |
parent | 646a4513e332987bffac54e8e37e086a4031a3e0 (diff) | |
download | gitbook-1b147d3e302046c1bb613332a2c0c18f7d8b21a0.zip gitbook-1b147d3e302046c1bb613332a2c0c18f7d8b21a0.tar.gz gitbook-1b147d3e302046c1bb613332a2c0c18f7d8b21a0.tar.bz2 |
Merge branch 'master' of https://github.com/tcorral/gitbook into tcorral-master
Conflicts:
theme/javascript/app.js
Diffstat (limited to 'theme/javascript')
-rwxr-xr-x | theme/javascript/app.js | 7 | ||||
-rwxr-xr-x | theme/javascript/core/navigation.js | 15 |
2 files changed, 18 insertions, 4 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js index 38a9572..3829a42 100755 --- a/theme/javascript/app.js +++ b/theme/javascript/app.js @@ -12,7 +12,8 @@ require([ "core/search" ], function($, storage, analytic, sharing, state, keyboard, navigation, progress, sidebar, search){ $(document).ready(function() { - var $book = state.$book; + var $book; + $book = state.$book; if (state.githubId) { // Initialize storage @@ -30,8 +31,8 @@ require([ // Bind sharing button sharing.init(); - + // Init navigation navigation.init(); }); -});
\ No newline at end of file +}); diff --git a/theme/javascript/core/navigation.js b/theme/javascript/core/navigation.js index 2a08dab..5c615ab 100755 --- a/theme/javascript/core/navigation.js +++ b/theme/javascript/core/navigation.js @@ -52,7 +52,15 @@ define([ var updateGitHubCounts = function() { $(".book-header .count-star span").text(githubCountStars); $(".book-header .count-watch span").text(githubCountWatch); - } + }; + + var updateNavigationPosition = function() { + 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'); + }; var preparePage = function() { // Bind exercises/quiz @@ -62,6 +70,9 @@ define([ // Show progress progress.show(); + // Update navigation position + updateNavigationPosition(); + // Reset scroll $(".book-body").scrollTop(0); @@ -125,6 +136,8 @@ define([ $(document).on('click', ".navigation-prev", handlePagination); $(document).on('click', ".navigation-next", handlePagination); $(document).on('click', ".summary [data-path] a", handlePagination); + + $(window).resize(updateNavigationPosition); // Prepare current page preparePage(); |