Forums / Cotonti / Skins / CSS Menu Current

GHengeveld
#26114 2010-09-16 00:44
I use Javascript to achieve this. Put this in footer.tpl:

<script type="text/javascript"> 
$(document).ready(function(){
    $('#cssmenu a').each(function(){
        if($(this).attr('href') == '{PHP.out.uri}') { $(this).addClass('active'); }
        if($(this).attr('href') == 'index.php' && '{PHP.out.uri}' == '') { $(this).addClass('active'); }
    });
});
</script>

Use .active in your css for the currently active menu item. You can replace 'index.php' in the second if statement with the link of your default page (index) if you need to. See my website for an example.