51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
$( document ).ready(function() {
|
|
// Shift nav in mobile when clicking the menu.
|
|
$(document).on('click', "[data-toggle='wy-nav-top']", function() {
|
|
$("[data-toggle='wy-nav-shift']").toggleClass("shift");
|
|
$("[data-toggle='rst-versions']").toggleClass("shift");
|
|
});
|
|
// Close menu when you click a link.
|
|
$(document).on('click', ".wy-menu-vertical .current ul li a", function() {
|
|
$("[data-toggle='wy-nav-shift']").removeClass("shift");
|
|
$("[data-toggle='rst-versions']").toggleClass("shift");
|
|
});
|
|
$(document).on('click', "[data-toggle='rst-current-version']", function() {
|
|
$("[data-toggle='rst-versions']").toggleClass("shift-up");
|
|
});
|
|
// Make tables responsive
|
|
$("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>");
|
|
});
|
|
|
|
window.SphinxRtdTheme = (function (jquery) {
|
|
var stickyNav = (function () {
|
|
var navBar,
|
|
win,
|
|
stickyNavCssClass = 'stickynav',
|
|
winScroll = false,
|
|
enable = function () {
|
|
navBar.addClass(stickyNavCssClass);
|
|
win.on('scroll', function() { // set flag on scroll event
|
|
winScroll = true;
|
|
});
|
|
// use setInterval to only handle a subset of scroll events so we don't kill scroll performance
|
|
setInterval(function() {
|
|
if (winScroll) {
|
|
winScroll = false;
|
|
navBar.scrollTop(win.scrollTop());
|
|
}
|
|
}, 100);
|
|
},
|
|
init = function () {
|
|
navBar = jquery('nav.wy-nav-side:first');
|
|
win = jquery(window);
|
|
};
|
|
jquery(init);
|
|
return {
|
|
enable : enable
|
|
};
|
|
}());
|
|
return {
|
|
StickyNav : stickyNav
|
|
};
|
|
}($));
|