コメントありがとうございます。 console.logの件は、どなたかがコメント…
フリックを感知
var TouchStart=0; var TouchMove=0; $(function(){ /*--- フリック ---*/ $('#Photo').bind({ 'touchstart':function(e){ e.preventDefault(); TouchStart=e.originalEvent.touches[0].pageX; }, 'touchmove':function(e){ e.preventDefault(); TouchMove=e.originalEvent.touches[0].pageX; }, 'touchend':function(e){ if(TouchStart>0 && TouchMove>0){ if(TouchStart>(TouchMove+50)){ alert('左にスクロールされました'); } else if((TouchStart+50)<touchMove){ alert('右にスクロールされました'); } } TouchStart=0; TouchMove=0; } }); });
コメントを残す