I am currently working with this jQuery code.
//this is the main javascript
$(document).ready(function(){
$('nav.menu a').hover(
function () {
$('nav.menu').find(".current_item").removeClass("current_item");
$(this).addClass("current_item");
},
function () {
$(this).removeClass("current_item");
$('nav.menu').find(".damenu").addClass("current_item")
}
);
});
Here is the HTML structure I am using:
<nav class="menu">
<a href="home.html" class="current_item damenu">Home</a>
<a href="gallery.html">Gallery</a>
<a href="home.html">Portfolio</a>
<a href="home.html">About</a>
<a href="home.html">Contact</a>
</nav>
This is the CSS associated with it:
.menu
{
background: 1px solid #00ffff;
width: 100%;
padding: 0px 0px 0px 10px;
}
.menu a
{
padding: 8px;
color: #0099ff;
font: bold 20px Archivo Narrow, Arial Rounded MT, Tahoma, Calibri, Asap, Arial, Verdana, sans-serif;
text-decoration: none;
float: left;
margin-right: 8px;
text-shadow: 2px 1px 1px #ffffff;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
}
.current_item /*, .menu a:hover*/
{
color: #C5F700 !important;
border-top: 3px solid #C5F700 !important;
border-bottom: 3px solid #C5F700 !important;
}
The current behavior is that when hovering over a menu item, the "current_item" class gets added and removed accordingly. However, I am looking to add animations to these borders on mouseover or mouseout events. Additionally, I'm curious if there's a way to center the navigation menu?
I welcome any ideas, recommendations, and suggestions from anyone who can assist. Thank you in advance.