Skip to content

Commit

Permalink
fix for touch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
looeee committed Oct 14, 2018
1 parent 3e3fbed commit 7cf3f82
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/webgl_multiple_scenes_comparison.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

sliderMoved = true;

sliderPos = e.pageX;
sliderPos = e.pageX || e.touches[ 0 ].pageX;

//prevent the slider from being positioned outside the window bounds
if ( sliderPos < 0 ) sliderPos = 0;
Expand All @@ -189,9 +189,11 @@
}

slider.addEventListener( 'mousedown', slideReady );
window.addEventListener( 'mouseup', slideFinish );
slider.addEventListener( 'touchstart', slideReady );
window.addEventListener( 'touchstop', slideFinish );

window.addEventListener( 'mouseup', slideFinish );
window.addEventListener( 'touchend', slideFinish );

window.addEventListener( 'mousemove', slideMove );
window.addEventListener( 'touchmove', slideMove );

Expand Down

0 comments on commit 7cf3f82

Please sign in to comment.