3 ms·
Yeah there's something really screwy going on here - I ended up having to disable JavaScript on the page in order to copy and paste from it without it leaping m
by simonw 4y ago
Yeah there's something really screwy going on here - I ended up having to disable JavaScript on the page in order to copy and paste from it without it leaping me up to the top when I tried.
- franciscop 4y agoIt seems to be because of this, any other key closes the modal and resets the hash, and resetting the hash scrolls you up: function closeModal() { let modal = document.getElementById("myModal"); modal.style.display = "none"; window.location.hash = ''; } // Left and right arrow keys scrub through the gallery. // Everything else closes the modal. document.onkeydown = function (e) { if (e.keyCode === 37) { // Left arrow goBackPrevImage(); } else if (e.keyCode === 39) { // Right arrow advanceNextImage(); } else { closeModal(); } };