From 3303d069b42ecbbd6c4f058b120b71b9074d5f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Fri, 10 Mar 2017 00:15:50 +0000 Subject: [PATCH] added slideshow: double click or swipe up to start and stop --- html/index.php | 25 +++++++++++++++++++++++++ html/style.css | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/html/index.php b/html/index.php index 78d91aa..bb7e20e 100644 --- a/html/index.php +++ b/html/index.php @@ -238,6 +238,23 @@ function singleimage() { var pos = ; var subpath = ''; var images = ; + var slide = false; + var timer = null; + function slideshow() { + slide = !slide; + if (timer) clearInterval(timer); + if (slide) { + $('#pos').text('slideshow started'); + $('#pos').fadeIn(1000, function() {$('#pos').fadeOut(1000)}); + timer = setInterval(function() { + next(); + }, 5000); + } else { + timer = nil; + $('#pos').text('slideshow started'); + $('#pos').fadeIn(1000, function() {$('#pos').fadeOut(1000)}); + } + } function next() { if (++pos>=images.length) { pos=0; @@ -280,6 +297,14 @@ function singleimage() { console.log('back') back() }) + $('div.image').on('swipeup', function(e) { + console.log('slideshow') + slideshow() + }) + $('div.image').dblclick(function(e) { + console.log('slideshow') + slideshow() + }) })