mirror of
https://github.com/scratchfoundation/scratchx.git
synced 2024-11-28 18:45:49 -05:00
Record the history when you switch pages
This commit is contained in:
parent
4fbe39264b
commit
e4180f8adb
1 changed files with 5 additions and 4 deletions
|
@ -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";
|
||||||
|
|
Loading…
Reference in a new issue