forked from Public/pics
PhotosIndex: fix arrow-key based navigation
This commit is contained in:
parent
b2bcb6a124
commit
af0c8990a6
@ -1,14 +1,14 @@
|
|||||||
function enableKeyDownNavigation() {
|
function enableKeyDownNavigation() {
|
||||||
document.addEventListener("keydown", function (event) {
|
document.addEventListener("keydown", function (event) {
|
||||||
if (event.keyCode == 37) {
|
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) {
|
if (target && target.href) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
document.location.href = target.href;
|
document.location.href = target.href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.keyCode == 39) {
|
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) {
|
if (target && target.href) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
document.location.href = target.href;
|
document.location.href = target.href;
|
||||||
|
Loading…
Reference in New Issue
Block a user