Jump to content

Help with Navigation Bar Underline Animation

Go to solution Solved by Lesum,

Recommended Posts

Posted (edited)

Hey all,

https://www.yuryourultimaterelationship.com/

I have inserted this code into my site's CSS to create a yellow "underline" effect when someone hovers on a navigation bar item.

.header-nav-item:not(.user-accounts-link) a:after {
	content: '';
	display: block;
	border-bottom: 1.5px solid #FFCA00;
  	transform: scaleX(0);  
  	transition: transform 500ms ease-in-out;
	transform-origin:  0% 50%;
}
.header-nav-item:not(.user-accounts-link) a:hover:after {
    transform: scaleX(1);
}

I would like to fix 2 issues:

1. If a page is selected that is listed in a dropdown menu, the purple underline for the dropdown folder name still shows on hover. I would like it to only have the yellow color when someone hovers.

Screenshot2024-06-15at5_41_27PM.thumb.png.74fc4a71a1abce258e8abb0330b92e63.png

2. On hover, the yellow underline spans the width of the entire container. I would like it to only underline the page name (same like the purple underline when page is selected).

Screenshot2024-06-15at5_43_07PM.thumb.png.781dff4a4d69ee23686cbd9099ace733.png

Screenshot2024-06-15at5_45_04PM.thumb.png.0416451f83a5b844e187ecabc25b434d.png

Thanks, all! ❤️

Edited by Arjuna
  • Replies 2
  • Views 979
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution
Posted

Hi @Arjuna To fix the issues you mentioned, add this code under Website > Pages > Website Tools > Custom CSS 

.header-nav-item.header-nav-item--folder.header-nav-item--active * {
    background-image: none !important;
}
span.header-nav-folder-item-content {
    background-image: none !important;
}

.header-nav-folder-item a {
    display: block !important;
    width: fit-content !important;
    float: right !important;
}

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Posted

Amazing, thank you!

This completely removes the purple underline when the page is selected, but actually it looks better this way.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.