I'm using twenty seventeen theme on wordpress (writing a child theme) When the home page first loads the nav bar is at the bottom of the screen, but the sub menu opens downwards and is therefore hidden. I'd like it to fly upwards until the page has scrolled down. First, is there a simple way to change this that I'm perhaps missing? (because it seems like a basic thing, yet I can't find any answer anywhere) Or do I need to change a class on scroll using jquery? (in which case I am really feeling about in the dark.) Can anyone help me with this? Vik
I'm using twenty seventeen theme on wordpress (writing a child theme) When the home page first loads the nav bar is at the bottom of the screen, but the sub menu opens downwards and is therefore hidden. I'd like it to fly upwards until the page has scrolled down. First, is there a simple way to change this that I'm perhaps missing? (because it seems like a basic thing, yet I can't find any answer anywhere) Or do I need to change a class on scroll using jquery? (in which case I am really feeling about in the dark.) Can anyone help me with this? Vik
The easiest way would be to react to the change of classes assigned to the main menu bar - when it docks top - there's added class .site-navigation-fixed
. Making it work fully is not so quick and easy process, especially when you do the edits in the Chrome developer tools :) You have to take care of the RWD version too.
I made some changes for you for a start:
@media screen and (min-width: 48em) {
.navigation-top.site-navigation-fixed ul li:hover > ul,
.navigation-top.site-navigation-fixed ul li.focus > ul {
top: 100px;
}
}
@media screen and (min-width: 48em) {
.main-navigation ul li:hover > ul, .main-navigation ul li.focus > ul {
left: -6.5em;
right: auto;
top: -100px;
}
}
Assuming you know the size of the submenu:
body.home ul.sub-menu { top:-100px; }
If you have different submenus you can use menu-item-XXX id to be more speecific.