Browse Source

Set img src when explore fragment changes

Causal Agent 2 months ago
parent
commit
f74c6a8eed
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      explore.html

+ 7
- 2
explore.html View File

@@ -64,14 +64,19 @@ Code is available from
64 64
 	let uarr = document.getElementById("uarr");
65 65
 	let rarr = document.getElementById("rarr");
66 66
 
67
-	let state = new URLSearchParams(document.location.hash.slice(1));
67
+	let state = new URLSearchParams();
68 68
 
69 69
 	function setImage() {
70 70
 		let url = new URL(tile.src);
71 71
 		url.search = "?" + state.toString();
72 72
 		tile.src = url.toString();
73 73
 	}
74
-	setImage();
74
+
75
+	window.onhashchange = function() {
76
+		state = new URLSearchParams(document.location.hash.slice(1));
77
+		setImage();
78
+	}
79
+	window.onhashchange();
75 80
 
76 81
 	function setState(x, y) {
77 82
 		state.set("x", x);

Loading…
Cancel
Save