navigational highlight based on url hash not working.

navigational highlight based on url hash not working.

Hey guys, can't quite wrap my head around why this doesn't work.  Pretty self-explanatory, but it grabs the hash (#lofts), chops it and adds the extension (lofts.php) then goes through the navigation, looking for an anchor with an href of lofts.php to add a class to...No class being added though.


$(function(){
$page = window.location.hash.substring(1) + '.php';
$('#project_navigation ul li a').each(function(){
    var $href = $(this).attr('href');
    if ($href == $page) {
        $(this).addClass("current");
    } else {
        $(this).removeClass("current");
    }
    });
});