edjafarov / remote-impress

This is remote Impress.js and Deck.js presentation controller. Allows to use phone for switching slides.

Home Page:remote.nodester.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Left/right swipe detection not working on Android 3.0<

Lindstromer opened this issue · comments

Fixed the problem for my presentation by changing to .on instead of .live and using evt.preventDefault!

Like this:

slide left or right to switch slides
<script> var touchStart = null; var touchEnd = null; var prevent=false; var socket = io.connect('<%=host%>/controller'); socket.emit('takeControl', <%=id%>); socket.on('presentationDied', function () { document.location.href = "http://remote.nodester.com/mobile"; }); function clean(){ $('#manipulator').html('slide left or right to switch slides'); } $(document).on('touchstart', '#manipulator', function(evt){ evt.stopPropagation(); evt.preventDefault(); touchStart = evt.originalEvent.touches[0].pageX; }); $(document).on('touchmove', '#manipulator', function(evt){ evt.stopPropagation(); evt.preventDefault(); touchEnd = evt.originalEvent.touches[0].pageX; if(touchStart - touchEnd < 0){ $('#manipulator').html("previous slide"); }else{ $('#manipulator').html("next slide"); } }); $(document).on('touchend', '#manipulator', function(evt){ touchEnd = evt.originalEvent.changedTouches[0].pageX; if(touchStart - touchEnd < 0){ clean(); socket.emit('previousSlide', <%=id%>); }else{ clean(); socket.emit('nextSlide', <%=id%>); } }); </script>