summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core/navigation.js
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/core/navigation.js')
-rwxr-xr-xtheme/javascript/core/navigation.js15
1 files changed, 14 insertions, 1 deletions
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();