diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/main.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/js/main.js b/src/js/main.js index f7ad5f4..20a1852 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -131,7 +131,7 @@ let project; let selectedTarget; const sym = Symbol(); -function presentTarget(targetName) { +function presentTarget(targetName, {autoload = false} = {}) { if (!project) { return; } @@ -180,7 +180,9 @@ function presentTarget(targetName) { // will push it out of the way). to deal with this, we should wait until all images positioned // before this target's element have loaded (but we should also make sure to skip images that // have already loaded). - setTimeout(() => el.scrollIntoView(), 100); + if (autoload) { + setTimeout(() => el.scrollIntoView(), 100); + } clearChildren(scriptArea); if (target.scripts.length) { @@ -225,6 +227,6 @@ function presentProject(p) { if (location.hash.includes(':')) { const targetName = decodeURIComponent(location.hash.slice(location.hash.indexOf(':') + 1)); - presentTarget(targetName); + presentTarget(targetName, {autoload: true}); } } |