/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> $(function(){ $page = location.pathname; if(!$page) { $page = 'index.html'; } $('ul.navigation li a').each(function(){ var $href = $(this).attr('href'); if ( ($href == $page) || ($href == '') ) { $(this).addClass('on'); } else { $(this).removeClass('on'); } }); }); </script>