jQuery change background on hover

jQuery change background on hover

HTML
<ul class="menu">
   <li>HOME</li>
   <li>ABOUT</li>
   <li>CONTACT</li>
   <li>PHOTO</li>
</ul>
CSS
ul{
    list-style: none;
}

ul li{
    font-size: 20px;
    margin: 10px;
    padding: 10px;
    cursor: pointer;
    display: inline-block;
}
Javascript
$(document).ready(function(){
    $(".menu li").hover(function(){
        $(this).css("background", "#95a1ff");
    },
    function(){
        $(this).css("background", "#FFF");
    });
});
389 Views
78190cookie-checkjQuery change background on hover

Leave a Reply

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