Ashwin Vasudevan
Ashwin Vasudevan

Reputation: 27

how to disappear the background image of a previous li element

As you can see, On hovering a li element,the right background image also disappears along with it with the help of background-image:none property. However only the hovered li disappears but the background image of previous li is still seen.Although a minor , I would like it removed. Can anyone tell me how?. :)

As I am new , Im not allowed to post images. Check the website out at http://ashwin931996.webege.com/ Thanks a lot btw

Upvotes: 1

Views: 100

Answers (1)

Selvamani
Selvamani

Reputation: 7684

Use this jquery. Here i paste the full html code. use this.

<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<link type="text/css" rel="stylesheet" href=""/>
<style type="text/css">
 #header ul {
    padding-top:1em;
      }

   #header ul li a.currentpage {
    color:white !important;
    background-color: #F96E5B !important;
   }

   #header ul li a {
    text-decoration: none;
    color:#676767;
    font-family: 'Oswald', sans-serif;
    font-size: 1em;
    float:right;
    line-height: 3em;
    padding-right: 1em;
    padding-left:1em;
       }


#header ul li a.active
{background-color: #F96E99;
color: white;}


</style>
</head>
<body>
<div id="header">
 <img id="logo" src="images/logo.jpg">
 <ul>
 <li>
<a class="one active" href="#">CONTACT</a>
</li>
<li>
<a class="two" href="#">GALLERY</a>
</li  class="one">
<li>
<a class="three" href="#">EVENTS</a>
</li>
<li>
<a class="four" href="#">HOME </a>
</li>
 </ul>          
 </div>
<script type="text/javascript">
$("#header ul li a").click( function() {
$("#header ul li a").removeClass("active");
$(this).addClass("active");
})
</script>


</body>
</html>​

Demo: http://jsfiddle.net/PbMg2/2/

Upvotes: 1

Related Questions