Preserve history when linking

This commit is contained in:
Ray Schamp 2015-05-06 10:45:05 -04:00
parent e7e49e070c
commit 0c04d14964

View file

@ -129,7 +129,12 @@ $("[data-action='load-url'] button").click(function(e) {
$("[data-staticlink]").click(function(e) { $("[data-staticlink]").click(function(e) {
e.preventDefault(); e.preventDefault();
showPage($(this).attr("data-staticlink")); var path = $(this).attr("data-staticlink");
showPage(path);
window.location.hash = $(this).attr('href');
if ($("body > main > article").has(path).length == 0) {
document.body.scrollTop = 0;
}
}); });
function showPage(path) { function showPage(path) {