html - change icon of a List with a Click with CSS -
i have navlist tabmenu this:
<ul> <li><a href="#1"><span></span></a></li> <li><a href="#2"><span></span></a></li> <li><a href="#3"><span></span></a></li> <li><a href="#4"><span></span></a></li> </ul>
now in css take background-img empty span, have icon in menu. how can change icon when click on link?
a:active click. need a:target. possible?
thanks lot!
there no way 'permanently' mark elements active/give them specific class using pure css.
an option using javascript/jquery follows:
<ul class="tab-menu"> <li><a href="#1"><span></span></a></li> <li><a href="#2"><span></span></a></li> <li><a href="#3"><span></span></a></li> <li><a href="#4"><span></span></a></li> </ul> <script> jquery(document).ready(function(){ $('ul.tab-menu li').click(e){ $('ul.tab-menu li').removeclass('active'); $(this).addclass('active'); } }); </script>
Comments
Post a Comment