Return to Snippet

Revision: 24290
at February 25, 2010 09:13 by humanoid


Initial Code
<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>

Initial URL

                                

Initial Description

                                

Initial Title
add class to highlight navigation item if page url

Initial Tags
navigation, jquery

Initial Language
jQuery