fix arrows

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

19
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) {
if (!document.querySelector("dialog").open) return
switch(e.key) {
case "ArrowLeft":
$(leftButtonQuery).click()
break
case "ArrowLeft":
$(leftButtonQuery).click()
break
case "ArrowRight":
$(rightButtonQuery).click()
break
case "ArrowRight":
$(rightButtonQuery).click()
break
default: return
default: return
}
e.preventDefault()
})