diff --git a/htmlslides.js b/htmlslides.js
index 91fb76c..3fc8216 100644
--- a/htmlslides.js
+++ b/htmlslides.js
@@ -77,6 +77,10 @@ function on_load() {
current_slide = find_slide(slide_anchors, window.location.hash);
}
+function on_resize() {
+ return go_to_slide(current_slide);
+}
+
function is_interactive_element(element) {
let tag = element.tagName.toLowerCase();
return (tag === "a" || tag === "button" || tag === "input");
@@ -211,5 +215,6 @@ function fail(msg, obj) {
}
window.addEventListener("load", on_load);
+window.addEventListener("resize", on_resize);
}());