- This topic has 11 replies, 2 voices, and was last updated 7 years, 12 months ago by
Tom.
-
AuthorPosts
-
April 1, 2018 at 7:26 pm #538213
Kle
Hi there,
I have a centered menu and I want the size of the sticky menu to match my menu items and not have a big white space on both sides of the menu. I only see the option to have it contained or full size but not a specific width size or a size to match the size of the width of the menu items.
Thank you.
April 1, 2018 at 9:17 pm #538247Tom
Lead DeveloperLead DeveloperAny chance you can link me to your site?
April 1, 2018 at 11:34 pm #538297Kle
I updated the first post with the website address and the username and password are after that divided by a slash /
April 2, 2018 at 9:25 am #538807Tom
Lead DeveloperLead DeveloperPlayed with this a bit – centering fixed items isn’t easy.
It’s possible, but it will break the “slide down” feature:
.main-navigation.navigation-stick:not(.gen-sidebar-nav) { width: auto !important; left: 50%; transform: translate(-50%, 0%) !important; }April 2, 2018 at 10:16 am #538852Kle
Thank you Tom,
I tried it and it doesn’t fit the menu tight, still white space on both sides. I didn’t thought would be a hard thing to do. And if is not possible I can understand it but in my opinion would be a good thing to add in a future release.
Which one is the “slide down” feature? I am using the code and don’t see any changes/errors so far.
Is it possible to apply this code only to the desktop view? how can I change the code to skip the mobile view?
Thank you.
April 2, 2018 at 9:13 pm #539295Tom
Lead DeveloperLead DeveloperThe non-sticky menu is actually full width, but if we applied CSS to it to make it auto width, it would likely match the current sticky menu.
I wonder if it would be better to just remove the sticky nav shadow instead of the above CSS? That way it would be very hard to tell the difference between the sticky and non-sticky menu.
The slide down feature makes it so the menu slides down as it becomes sticky.
To make something happen on desktop only using CSS, put your CSS in this media query:
@media (min-width: 769px) { /* Your desktop CSS in here */ }April 4, 2018 at 10:41 pm #541561Kle
“I wonder if it would be better to just remove the sticky nav shadow instead of the above CSS?”
Hi Tom, Thank you very much and you are probably right, how can I remove the shadow?
April 5, 2018 at 10:41 am #542179Tom
Lead DeveloperLead DeveloperTry this:
.sticky-enabled .main-navigation.is_stuck { box-shadow: 0 0 0 transparent; }April 5, 2018 at 10:53 am #542192Kle
Hi Tom,
Thank you but for som reason the code didn’t work on my site. I wonder why?
April 5, 2018 at 10:07 pm #542612Tom
Lead DeveloperLead DeveloperCan you try the adjusted CSS above?: https://generatepress.com/forums/topic/sticky-menu-width-size/#post-542179
April 6, 2018 at 7:36 am #542927Kle
Perfect,
Thank you Tom!
April 6, 2018 at 9:36 am #543096Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.