Skip to content

Instantly share code, notes, and snippets.

@bdemartino
Created April 3, 2013 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bdemartino/5303212 to your computer and use it in GitHub Desktop.
Save bdemartino/5303212 to your computer and use it in GitHub Desktop.
function showLocation(){
var currentLocation = (window.location.hash).replace('#','');
if(currentLocation !== '' && currentLocation != null && typeof currentLocation !== "undefined"){
$('.activeLocation').addClass('hide').removeClass('activeLocation');
$('.' + currentLocation).removeClass('hide').addClass('activeLocation');
}
}
if (Modernizr.hashchange){
window.onhashchange = showLocation;
} else if (Modernizr.hashchange === false){ // IE7 fallback
$('.btn-branch').on('click', function (e) {
e.preventDefault();
var clickedLocation = $(this).attr('href');
window.location.hash = clickedLocation;
window.location.reload();
});
}
$(function(){
showLocation();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment