fix arrows

This commit is contained in:
Zhora Shalyapin 2025-03-10 08:47:21 +00:00
parent 825ebcc106
commit 061278ec0a

23
main.js
View File

@ -617,21 +617,22 @@
}, },
}) })
bindArrowForGallery('.swiper-button-prev', '.swiper-button-next') bindArrowsForGallery('.swiper-button-prev', '.swiper-button-next')
} }
function bindArrowForGallery(leftButtonQuery, rightButtonQuery) { function bindArrowsForGallery(leftButtonQuery, rightButtonQuery) {
document.addEventListener("keydown", function(e) { document.addEventListener("keydown", function(e) {
if (!document.querySelector("dialog").open) return
switch(e.key) { switch(e.key) {
case "ArrowLeft": case "ArrowLeft":
$(leftButtonQuery).click() $(leftButtonQuery).click()
break break
case "ArrowRight": case "ArrowRight":
$(rightButtonQuery).click() $(rightButtonQuery).click()
break break
default: return default: return
} }
e.preventDefault() e.preventDefault()
}) })