Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Created August 26, 2013 05:39
Show Gist options
  • Save jwebcat/6338370 to your computer and use it in GitHub Desktop.
Save jwebcat/6338370 to your computer and use it in GitHub Desktop.
change css based on url hash
if (window.location.hash.split('-')[0] == '#item') {
$('ul.side').addClass('hashed');
}
// the below is questionable
$(function () {
if (window.location.hash) {
getHash();
}
$(window).on("hashchange", function () {
getHash();
});
});
function getHash() {
var loc = (window.location.hash).split("-");
if (loc[0] == "#item") {
console.log("item found");
// $('ul.side').addClass('hashed');
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment