jQuery change color on hover

jQuery change color on hover

HTML
<ul class="menu">
   <li>HOME</li>
   <li>ABOUT</li>
   <li>CONTACT</li>
   <li>PHOTO</li>
</ul>
CSS
.active{
  color: red;
}

ul{
  list-style: none;
}

ul li{
  cursor: pointer;
  display: inline-block;
  margin: 10px;
}
Javascript
$('.menu li').hover(function() {
   $(this).addClass('active');
},
   function() {(this).removeClass('active');
});
465 Views
78210cookie-checkjQuery change color on hover

Leave a Reply

Your email address will not be published. Required fields are marked *