vpfjsphp:adding_touch_events
adjust viewport
<meta name="viewport" content="width=1200"> <meta name="apple-mobile-web-app-capable" content="yes">
touchstart
function touch_start(e) { e.preventDefault(); var which_art = e.target; var touch = e.touches[0]; var move_offset_x = which_art.offsetLeft - touch.pageX; var move_offset_y = which_art.offsetTop - touch.pageY; resetZ(); which_art.style.zIndex = 10; which_art.addEventListener('touchmove', function() { var positionX = touch.pageX+moveOffsetX; var positionY = touch.pageX+moveOffsetY; which_art.style.left = positionX + 'px'; which_art.style.top = positionY + 'px'; }, false); } document.querySelector('body').addEventListener('touchstart', touchStart, false);
vpfjsphp/adding_touch_events.txt · Last modified: 2016/03/06 22:02 by leo