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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -