javascript - Question on iPad Safari Event Handler -
lets have box/table multiple rows..these rows draggable.
now have js have implemented event handlers touchstart,touchmove, touchend ipad....basically map these events corresponding mouse events mouseover, mousedown, mouseup, etc
now here issue;
while able drag of rows table, want able scroll it. when press finger on screen , drag down, drag action row (since using event.preventdefault() touchmove prevent default scrolling region).
now understand cannot have both actions (drag/scroll) using single finger.. want implement/have scroll action when 2-fingers used..(the other case i.e. single finger, should drag action)
now aware event.touches.length/event.targettouches.length gives no of fingers on screen, not sure how use scrolling action...just fyi, scrolling similar on ipad fixed height div scrolling (overflow:auto), ipad provides out-of-the-box..
thank you.
you fire preventdefault later, , optionally. figuring out if want custom / drag behavior first.
something this: ( have no idea if exact code work since cannot test right now, assumes use jquery, , don't know event properties number of fingers give idea:)
$('#someelement').touchmove( function(e) { if( /* number of fingers equals 1 */ ) { e.preventdefault() //more element-drag code go here return; } } );
Comments
Post a Comment