summaryrefslogtreecommitdiffstats
path: root/theme/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript')
-rwxr-xr-xtheme/javascript/app.js7
-rwxr-xr-xtheme/javascript/core/navigation.js15
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();