Record the history when you switch pages

This commit is contained in:
Ray Schamp 2015-05-06 14:59:55 -04:00
parent 4fbe39264b
commit e4180f8adb

View file

@ -152,10 +152,6 @@ $("[data-staticlink]").click(function(e) {
e.preventDefault(); e.preventDefault();
var path = $(this).attr("data-staticlink"); var path = $(this).attr("data-staticlink");
showPage(path); 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) {
@ -165,6 +161,11 @@ function showPage(path) {
$(toHide).hide(); $(toHide).hide();
$("body > main, body > main > article").has(toShow).show(); $("body > main, body > main > article").has(toShow).show();
$(toShow).show(); $(toShow).show();
window.location.hash = toShow;
if ($("body > main > article").has(toShow).length == 0) {
document.body.scrollTop = 0;
}
} }
var initialID = "home"; var initialID = "home";