From 96d7edb307917b2e5c04ad116191c459e8e71055 Mon Sep 17 00:00:00 2001 From: ajurna Date: Wed, 27 May 2020 11:23:21 +0100 Subject: [PATCH] fixed on click navigation to transition between pages. --- comic/templates/comic/read_comic.html | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/comic/templates/comic/read_comic.html b/comic/templates/comic/read_comic.html index 320dc69..6d9e051 100644 --- a/comic/templates/comic/read_comic.html +++ b/comic/templates/comic/read_comic.html @@ -7,7 +7,7 @@
{% for page in pages %} -
+
{% endfor %}
@@ -38,11 +38,7 @@ $(document).keydown(function(e) { switch(e.which) { case 37: // left - if (Reveal.isFirstSlide()){ - window.location = "{% url "read_comic" nav.prev_path %}" - } else { - Reveal.prev(); - } + prevPage() break; case 38: // up @@ -54,11 +50,7 @@ break; case 39: // right - if (Reveal.isLastSlide()){ - window.location = "{% url "read_comic" nav.next_path %}" - } else { - Reveal.next() - } + nextPage() break; case 40: // down @@ -89,5 +81,19 @@ Reveal.prev(); } }) + function prevPage() { + if (Reveal.isFirstSlide()){ + window.location = "{% url "read_comic" nav.prev_path %}" + } else { + Reveal.prev(); + } + } + function nextPage() { + if (Reveal.isLastSlide()){ + window.location = "{% url "read_comic" nav.next_path %}" + } else { + Reveal.next() + } + } {% endblock %} \ No newline at end of file