Created
December 12, 2012 16:53
-
-
Save jerryharrison/4269462 to your computer and use it in GitHub Desktop.
Javascript: Grabbing the hash from the location.href and targeting a specific state on a page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// auto open the album | |
var hash = window.location.hash.toString().replace('#','').split('-'); | |
if(hash != ''){ | |
// console.log(hash); | |
if (hash[2] != undefined) { | |
// console.log('Loading collection: ' + hash[1] + ' width image ID: ' + hash[2]); | |
getCollectionModalWithImage(hash[1],hash[2]); | |
$("#CanvasGrid li#Collection-" + hash[1] + " div").click(); | |
} else if (hash[1] != undefined) { | |
// console.log('Loading collection: ' + hash[1]); | |
$("#CanvasGrid li#Collection-" + hash[1] + " div").click(); | |
} else { | |
// console.log('Loading page: ' + hash[0]); | |
$(".menu a." + hash[0]).click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment