Skip to content

Instantly share code, notes, and snippets.

@alastaircoote
Created April 14, 2013 20:19
Show Gist options
  • Save alastaircoote/5384053 to your computer and use it in GitHub Desktop.
Save alastaircoote/5384053 to your computer and use it in GitHub Desktop.
Hashchange event hook
var hashChange = function() {
var el = document.getElementById(window.location.hash.substr(1));
$(".activeTr").removeClass("activeTr").find("td").css({
"background":"",
"color":""
});
$(el).parent().addClass("activeTr").find("td").css({
"background":"#08c",
"color":"#fff"
});
}
$(window).on("hashchange",hashChange);
hashChange();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment