Rather than use .attr hook
I would use data-hook
and .data
. That's not the problem.
You were never actually comparing that the "hook" value matched the hash.
if ($(this).attr('hook') === hash.replace('#about', '')) {
You also need to display the first section if the hash is empty (I suppose), but I'm sure you can figure that out.