handle left/right arrow keys for album nav

This commit is contained in:
Nick Pegg 2024-08-04 08:35:45 -07:00
parent ac08b1fc84
commit d1dcb610d6
2 changed files with 20 additions and 1 deletions

View file

@ -1,5 +1,20 @@
{% extends "base.html" %}
{% block js %}
// Do left/right navigation on keypresses
document.onkeydown = function(event) {
if (event.key == "ArrowLeft") {
{% if prev_image %}
location.href = "{{prev_image.html_filename()}}";
{% endif %}
} else if (event.key == "ArrowRight") {
{% if next_image %}
location.href = "{{next_image.html_filename()}}";
{% endif %}
}
}
{% endblock %}
{% block content %}
<div id="nav">
<div>