Jquery, ipad(touch device) select multiple items

367 views Asked by At

suppose we have a table and users may select more than one row at time, i can do that on desktop browsers with

<td onmousedown= onmousemove= onmouseup= >

but it fails with touch devices (ipad), i tried with touchstart, i can get the starting element, but touchend does not give the finishing element, i want:

<tr><td id="id1">
//
<tr><td id="id5">

$('td).on('touchstart', function(e) {
     console.log('touchstart' + $(this).attr("id"));
}

$('td).on('touchend', function(e) {
     console.log('touchend' + $(this).attr("id"));
}

when i start dragging on id1 and move until id5 (i walk over i2, i3, i4), i want to discover that user selected i1, i2, i3, i4 and i5. i start dragging in i1 and finish on i5 (release finger)

i see touchstart i1, it is OK, but touchend also gives i1, but i expect i5. I want to learn on which element the drag(touch) operation finished.

mouseover or mouseenter also gives always the starting point. i mean when the finger is on i2, console always shows the starting id.

i looked in chrome tools in the event on touchend, (all event fields, properties etc) but could not find anything about the target id (element on which we stop the operation, release finger)

0

There are 0 answers