PhotosIndex: fix arrow-key based navigation

This commit is contained in:
Aaron van Geffen 2023-03-20 18:30:30 +01:00
parent b2bcb6a124
commit af0c8990a6

View File

@ -1,14 +1,14 @@
function enableKeyDownNavigation() {
document.addEventListener("keydown", function (event) {
if (event.keyCode == 37) {
var target = document.querySelector(".pagination ul > :first-child a");
var target = document.querySelector("ul.pagination > :first-child a");
if (target && target.href) {
event.preventDefault();
document.location.href = target.href;
}
}
else if (event.keyCode == 39) {
var target = document.querySelector(".pagination ul > :last-child a");
var target = document.querySelector("ul.pagination > :last-child a");
if (target && target.href) {
event.preventDefault();
document.location.href = target.href;