mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 02:23:30 +00:00
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.
This commit is contained in:
+42
-40
@@ -1,52 +1,54 @@
|
||||
require([
|
||||
"jQuery",
|
||||
"utils/storage",
|
||||
"utils/analytic",
|
||||
"utils/sharing",
|
||||
"jQuery",
|
||||
"utils/storage",
|
||||
"utils/analytic",
|
||||
"utils/sharing",
|
||||
|
||||
"core/state",
|
||||
"core/keyboard",
|
||||
"core/exercise",
|
||||
"core/quiz",
|
||||
"core/progress",
|
||||
"core/sidebar",
|
||||
"core/search"
|
||||
], function($, storage, analytic, sharing, state, keyboard, exercise, quiz, progress, sidebar, search){
|
||||
$(document).ready(function() {
|
||||
var $book = state.$book;
|
||||
"core/state",
|
||||
"core/keyboard",
|
||||
"core/exercise",
|
||||
"core/progress",
|
||||
"core/sidebar",
|
||||
"core/search"
|
||||
], function($, storage, analytic, sharing, state, keyboard, exercise, progress, sidebar, search){
|
||||
$(document).ready(function() {
|
||||
var $book, bodyInnerWidth, pageWrapperWidth;
|
||||
$book = state.$book;
|
||||
|
||||
// Init sidebar
|
||||
sidebar.init();
|
||||
// Init sidebar
|
||||
sidebar.init();
|
||||
|
||||
// Load search
|
||||
search.init();
|
||||
// Load search
|
||||
search.init();
|
||||
|
||||
// Init keyboard
|
||||
keyboard.init();
|
||||
// Init keyboard
|
||||
keyboard.init();
|
||||
|
||||
if (state.githubId) {
|
||||
// Initialize storage
|
||||
storage.setBaseKey(state.githubId);
|
||||
if (state.githubId) {
|
||||
// Initialize storage
|
||||
storage.setBaseKey(state.githubId);
|
||||
|
||||
// Star and watch count
|
||||
$.getJSON("https://api.github.com/repos/"+state.githubId)
|
||||
.done(function(repo) {
|
||||
$book.find(".count-star span").text(repo.stargazers_count);
|
||||
$book.find(".count-watch span").text(repo.subscribers_count);
|
||||
});
|
||||
}
|
||||
// Star and watch count
|
||||
$.getJSON("https://api.github.com/repos/"+state.githubId)
|
||||
.done(function(repo) {
|
||||
$book.find(".count-star span").text(repo.stargazers_count);
|
||||
$book.find(".count-watch span").text(repo.subscribers_count);
|
||||
});
|
||||
}
|
||||
|
||||
// Bind exercises
|
||||
exercise.init();
|
||||
quiz.init();
|
||||
// Bind exercise
|
||||
exercise.init();
|
||||
|
||||
// Bind sharing button
|
||||
sharing.init();
|
||||
// Bind sharing button
|
||||
sharing.init();
|
||||
|
||||
// Show progress
|
||||
progress.show();
|
||||
// Show progress
|
||||
progress.show();
|
||||
|
||||
// Focus on content
|
||||
$(".book-body").focus();
|
||||
});
|
||||
// Focus on content
|
||||
$(".book-body").focus();
|
||||
bodyInnerWidth = parseInt($('.body-inner').css('width'), 10);
|
||||
pageWrapperWidth = parseInt($('.page-wrapper').css('width'), 10);
|
||||
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user