handle left/right arrow keys for album nav
This commit is contained in:
parent
ac08b1fc84
commit
d1dcb610d6
2 changed files with 20 additions and 1 deletions
|
@ -3,13 +3,17 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="{{ static_dir }}/index.css" type="text/css">
|
|
||||||
<title>My Photos</title>
|
<title>My Photos</title>
|
||||||
|
<link rel="stylesheet" href="{{ static_dir }}/index.css" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
{% block js %}
|
||||||
|
{% endblock %}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
{% extends "base.html" %}
|
{% 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 %}
|
{% block content %}
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue