change .onresize to .addEventListener('resize')

This appears to fix an issue (presumably where .onresize was being
overwritten?) where the width of the document wouldn't update correctly.

This doesn't solve that whole class of issues -- there are many
assumptions made, including that the orientation or device type of the
page won't change after load (so e.g. rotating a device can cause
issues), but those are systemic enough that I'm not going to dare to fix
them this time!
This commit is contained in:
Chandler Swift 2025-01-04 14:48:53 -06:00
parent b6089eba54
commit b5531b7231
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -33,9 +33,9 @@
<script> <script>
const storymap_options = {}; const storymap_options = {};
const storymap = new KLStoryMap.StoryMap('mapdiv', 'data.json', storymap_options); const storymap = new KLStoryMap.StoryMap('mapdiv', 'data.json', storymap_options);
window.onresize = function(event) { document.addEventListener("resize", function(event) {
storymap.updateDisplay(); // this isn't automatic storymap.updateDisplay(); // this isn't automatic
} });
</script> </script>
</body> </body>
</html> </html>