sol2/sphinx_rtd_theme/static/js/theme.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2013-10-29 07:07:26 +08:00
$( document ).ready(function() {
2013-10-22 06:52:35 +08:00
// Shift nav in mobile when clicking the menu.
2013-10-29 07:07:26 +08:00
$("[data-toggle='wy-nav-top']").click(function() {
2013-10-22 06:52:35 +08:00
$("[data-toggle='wy-nav-shift']").toggleClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
// Close menu when you click a link.
2013-10-29 07:07:26 +08:00
$(".wy-menu-vertical .current ul li a").click(function() {
2013-10-22 06:52:35 +08:00
$("[data-toggle='wy-nav-shift']").removeClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
2013-10-29 07:07:26 +08:00
$("[data-toggle='rst-current-version']").click(function() {
2013-10-22 06:52:35 +08:00
$("[data-toggle='rst-versions']").toggleClass("shift-up");
2013-10-31 01:14:23 +08:00
});
$("table.docutils:not(.field-list").wrap("<div class='wy-table-responsive'></div>");
2013-10-22 06:52:35 +08:00
});
window.SphinxRtdTheme = (function (jquery) {
var stickyNav = (function () {
var navBar,
win,
stickyNavCssClass = 'stickynav',
applyStickNav = function () {
if (navBar.height() <= win.height()) {
navBar.addClass(stickyNavCssClass);
} else {
navBar.removeClass(stickyNavCssClass);
}
},
enable = function () {
applyStickNav();
win.on('resize', applyStickNav);
},
init = function () {
navBar = jquery('nav.wy-nav-side:first');
win = jquery(window);
};
jquery(init);
return {
enable : enable
};
}());
return {
StickyNav : stickyNav
};
}($));