diff options
author | June McEnroe <june@causal.agency> | 2019-01-07 01:34:59 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-01-07 01:34:59 -0500 |
commit | f74c6a8eeda788788694bcd5de4369a3956567b4 (patch) | |
tree | 826d0b9be663e565d71ce3fdea90c24ea68c34dc /explore.html | |
parent | Compress PNG data in image (diff) | |
download | torus-f74c6a8eeda788788694bcd5de4369a3956567b4.tar.gz torus-f74c6a8eeda788788694bcd5de4369a3956567b4.zip |
Set img src when explore fragment changes
Diffstat (limited to '')
-rw-r--r-- | explore.html | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/explore.html b/explore.html index 3d5e1bc..d9b1ddb 100644 --- a/explore.html +++ b/explore.html @@ -64,14 +64,19 @@ Code is available from let uarr = document.getElementById("uarr"); let rarr = document.getElementById("rarr"); - let state = new URLSearchParams(document.location.hash.slice(1)); + let state = new URLSearchParams(); function setImage() { let url = new URL(tile.src); url.search = "?" + state.toString(); tile.src = url.toString(); } - setImage(); + + window.onhashchange = function() { + state = new URLSearchParams(document.location.hash.slice(1)); + setImage(); + } + window.onhashchange(); function setState(x, y) { state.set("x", x); |