From 8c08181ebcbc041a8cf26b7ee40532de1cf75e8c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 9 Aug 2016 09:23:20 -0500 Subject: [PATCH] Make currentSlide an integer This fixes the behaviour where if you have > 10 slides, go to slide 1, reload, and hit next, you are taken to slide 11 instead of slide 2 The incorrect behaviour is a result of adding a number to a string which results in a string - e.g. "1" + 1 = "11" --- src/slide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slide.js b/src/slide.js index 753eff1..cb0ed62 100644 --- a/src/slide.js +++ b/src/slide.js @@ -110,7 +110,7 @@ function prev() { window.onload = function() { resize(); render(document.getElementById('slide').innerHTML); - goTo(window.location.hash.substring(1)||0); + goTo(parseInt(window.location.hash.substring(1),10)||0); window.onclick = next; window.onresize = resize; window.onkeydown = function(e) {