|
@@ -1,5 +1,10 @@
|
|
|
// The number of pixels the user must scroll by before the logo is hidden.
|
|
|
-const scrollTopPixels = 40;
|
|
|
+const scrollTopPixels = 234;
|
|
|
+
|
|
|
+// The margin to apply to the menu when the search bar is made fixed.
|
|
|
+// Should roughly match the logo's height as to not hide the top menu items
|
|
|
+// behind it.
|
|
|
+const menuTopMargin = '330px';
|
|
|
|
|
|
// Hide the navigation bar logo when scrolling down on desktop platforms.
|
|
|
// The logo is quite tall, so this helps make the rest of the navigation bar
|
|
@@ -7,6 +12,8 @@ const scrollTopPixels = 40;
|
|
|
function registerOnScrollEvent(mediaQuery) {
|
|
|
// The navigation bar that contains the logo.
|
|
|
const $navbar = $('.wy-side-scroll');
|
|
|
+ const $menu = $('.wy-menu-vertical');
|
|
|
+ const $search = $('.wy-side-nav-search');
|
|
|
|
|
|
// The anchor that contains the logo. This element will be hidden
|
|
|
// (instead of hiding just the logo), otherwise, a small clickable area
|
|
@@ -18,8 +25,12 @@ function registerOnScrollEvent(mediaQuery) {
|
|
|
$navbar.scroll(function() {
|
|
|
if ($(this).scrollTop() >= scrollTopPixels) {
|
|
|
$logo.hide();
|
|
|
+ $search.css('position', 'fixed');
|
|
|
+ $menu.css('margin-top', menuTopMargin);
|
|
|
} else {
|
|
|
$logo.show();
|
|
|
+ $search.css('position', 'static');
|
|
|
+ $menu.css('margin-top', 0);
|
|
|
}
|
|
|
});
|
|
|
} else {
|