jQWidgets Forums

jQuery UI Widgets Forums Lists ListBox dragEnd event Properties 'clientX' and 'clientY' are undefined on iOS Reply To: dragEnd event Properties 'clientX' and 'clientY' are undefined on iOS


Peter Stoev
Keymaster

Hi David,

The code I posted you i.e the getTouhes function assumes that ‘e’ is a ‘touchend’ event, not ‘dragEnd’.

Actually, this is already done in the demos provided with the installation:

See the Online Demo here:

http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxlistbox/dragdrop.htm?classic

And this is the code for getting Location:

              $("#listBoxA, #listBoxB").bind('dragEnd', function (event) {
$("#dragEndLog").text("Drag End");
if (event.args.label) {
var ev = event.args.originalEvent;
var x = ev.pageX;
var y = ev.pageY;
if (event.args.originalEvent.originalEvent.touches) {
var touch = event.args.originalEvent.originalEvent.changedTouches[0];
x = touch.pageX;
y = touch.pageY;
}
var offset = $("#textarea").offset();
var width = $("#textarea").width();
var height = $("#textarea").height();
var right = parseInt(offset.left) + width;
var bottom = parseInt(offset.top) + height;
if (x >= parseInt(offset.left) && x <= right) {
if (y >= parseInt(offset.top) && y <= bottom) {
$("#textarea").val(event.args.label);
}
}
}
});

Best Regards,
Peter Stoev

jQWidgets Team
http://www.jqwidgets.com