Why do I lose css hover functionality on menu items after changing attributes with jquery? -


i have navigation menu link css attributes modify when clicking them. when click on links they're css properties change should.

but before initiating jquery css psuedo :hover worked on .cmnavitem a:hover worked fine doesn't work after of jquery functions have run?

here code:

<nav id="cmnavcontainer"><!-- start of side menu -->      <ul id="cmnav">         <li class="cmnavitem"><a href="#" id="navitem1">link 1</a></li>         <li class="cmnavitem"><a href="#" id="navitem2">link 2</a></li>         <li class="cmnavitem"><a href="#" id="navitem3">link 3</a></li>         <li class="cmnavitem"><a href="#" id="navitem4">link 4</a></li>         <li class="cmnavitem"><a href="#" id="navitem5">link 5</a></li>     </ul>  </nav><!-- closes cmnav --> 

css:

.cmnavitem a:link, .cmnavitem a:visited{         border-bottom:1px solid #323233;         border-top:1px solid #323233;         line-height:30px;         width:182px;         display:block;         margin-left:0;         padding-left:10px;          font-size:15px;         font-family:arial,sans-serif;         color:#fff;         font-weight:bold;     }         .cmnavitem a:hover{             border-bottom:1px solid #000;             border-top:1px solid #2a2a2b;         } 

jquery:

$(document).ready(function(){      $(".cmnavitem a").on('click', function(){         $(this).css({         'border-bottom-color':'000',         'border-top-color': '2a2a2b',          });         $(this).css('opacity','1').closest('.cmnavitem').siblings('.cmnavitem').find('a').css({         'opacity': '0.3',         'border-bottom-color': '323233',         'border-top-color': '323233'         });       });      $("#cmnavcontainer").animate({left: 0}, 1000);       $(document).on('click', function(e) {         if ( ! $(e.target).closest('.cmnavitem').length ) {             // clicked anywhere on element inside #linkitem (or itself)             $('.cmnavitem a').css({             'opacity': '2',             'border-bottom-color': '323233',             'border-top-color': '323233'              });         }     });  }); 

what need able have css :hover work again after jquery runs?

thanks

imo hover-effect still works. way, colors #000, #2a2a2a, #323232 may pretty same @ 1px line. if change hover border-colors easier see (lets #0f0 , #f00) can see hovering.

http://jsfiddle .net/2qfqh/ 

tested on ff 20, opera 12, chrome 26, ie 10


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -