Last active
January 3, 2016 02:19
-
-
Save liquorice/8394584 to your computer and use it in GitHub Desktop.
set document.location.href without causing the viewport to scroll
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
var set_document_hash = function(hash) { | |
var id = hash, | |
temp_id = "TEMP-" + hash, | |
target = $("#" + id); | |
if (target.length) target.attr("id", temp_id); | |
document.location.hash = hash; | |
if (target.length) target.attr("id", id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment