Created
November 1, 2011 02:15
-
-
Save gotoplanb/1329658 to your computer and use it in GitHub Desktop.
Strip the URL after a hash in order to do animation on single-page website.
This file contains hidden or 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
// Strip the URL after a hash in order to do animation on single-page website. | |
// Should be replaced with $(this).attr('href') | |
var urlClicked = "http://smartmediacreative.com/index.php#optimize"; | |
// Loop throught the href to find the hash. | |
var counter = 0; | |
while (urlClicked[counter] !== '#') { | |
counter += 1; | |
} | |
// Slice the href from hash to end to keep the ID of the div that should become active. | |
var activeDiv = urlClicked.slice(counter + 1); | |
// Alert as diagnostic | |
alert(activeDiv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment