- This topic has 9 replies, 3 voices, and was last updated 4 years, 11 months ago by
David.
-
AuthorPosts
-
April 28, 2021 at 7:05 am #1753318
Brian
I am trying to add a hover effect to the menu links, I tried the code here: https://docs.generatepress.com/article/adding-menu-hover-animation/ and also the code here: https://generatepress.com/forums/topic/how-to-add-a-hover-underline-in-primary-navigation/ but neither seemed to work. I suggest my links might have different css class names?
Would you mind having a look?
Also is it possible that the active page stayed underlined?
It would be good to add an underline option to the menu options as it seems to be a common request from users.
Thanks
April 28, 2021 at 8:28 am #1753556Ying
StaffCustomer SupportHi Brian,
I modified the CSS, try this one:
@media (min-width: 769px) { .main-navigation .menu > .page_item > a::after { content: ""; position: absolute; right: 0; left: 50%; bottom: 15px; -webkit-transform: translate3d(-50%,0,0); transform: translate3d(-50%,0,0); display: block; width: 0; height: 2px; background-color: currentColor; transition: 0.3s width ease; } .main-navigation .menu > .page_item.current-menu-item > a::after, .main-navigation .menu > .page_item:hover > a::after { width: 50%; } }Let me know how it works 🙂
April 28, 2021 at 10:40 am #1753821Brian
Thank you Ying. That works. You might want to update the help documentation.
April 28, 2021 at 11:21 am #1753911Ying
StaffCustomer SupportGlad to hear that 🙂
The CSS in documentation should work for most users, it’s just your menu has a different class.
April 28, 2021 at 12:35 pm #1754040Brian
Any idea why mine is different? It’s a new install of GP and GB
Is it because I used a child theme?
Just curious.
April 28, 2021 at 2:43 pm #1754145Ying
StaffCustomer SupportI’m actually not sure, your menu items are missing some default CSS classes, how did you add them?
April 29, 2021 at 1:25 am #1754874Brian
I actually did not even add the links, these are the default pages. I only started to create the site yesterday using a clean install of GB and GP. Is something different in GP premium 2?
April 29, 2021 at 4:03 am #1755132David
StaffCustomer SupportHi there,
that would mean you have not created a Menu and assigned it to the Navigation – in that instance WP auto generates a menu that has only the
page_itemclassApril 29, 2021 at 6:11 am #1755383Brian
That was it David, thanks for your help.
April 29, 2021 at 7:18 am #1755750David
StaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.