mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Turning off sticky navigation if navbar is taller than window
Conflicts: sass/_theme_layout.sass sphinx_rtd_theme/layout.html
This commit is contained in:
parent
bcf2276d5b
commit
30f5c683eb
|
@ -286,6 +286,6 @@ footer
|
|||
.wy-nav-content-wrap
|
||||
margin-left: 0
|
||||
|
||||
.stickynav
|
||||
nav.stickynav
|
||||
position: fixed
|
||||
top: 0
|
||||
|
|
|
@ -53,6 +53,15 @@
|
|||
<script type="text/javascript" src="_static/js/theme.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{# STICKY NAVIGATION #}
|
||||
{% if theme_sticky_navigation %}
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% for cssfile in css_files %}
|
||||
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
|
||||
{% endfor %}
|
||||
|
@ -94,7 +103,7 @@
|
|||
<div class="wy-grid-for-nav">
|
||||
|
||||
{# SIDE NAV, TOGGLES ON MOBILE #}
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side{% if theme_sticky_navigation %} stickynav{% endif %}">
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-nav-search">
|
||||
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}</a>
|
||||
{% include "searchbox.html" %}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,3 +14,50 @@ $( document ).ready(function() {
|
|||
});
|
||||
$("table.docutils:not(.field-list").wrap("<div class='wy-table-responsive'></div>");
|
||||
});
|
||||
|
||||
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
|
||||
};
|
||||
}($));
|
Loading…
Reference in New Issue
Block a user