Forums / Cotonti / Skins / CSS Menu Current

GHengeveld
#26116 2010-09-16 06:57
Correct. You'd have to use indexOf for that:

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

indexOf looks for the first instance and returns its position. Position 0 is at the beginning of the string.