arrastre anidado de jquery en ipad

Tengo la siguiente configuración:

$(".window").draggable({
        containment: "document",
        cancel: ".contact"
    });

$(".contact").draggable({
        containment: "document",
        revert: "invalid",
        helper: "clone",
        appendTo: "body",
        zIndex: "10000",
        start: function (event, ui) {$(".window").draggable("disable"); },
        stop: function (event, ui) {$(".window").draggable("enable"); }
    });

$("#my_list").droppable({
        accept: ".contact",
    });

The contact is a list element which is nested inside a window element. I want to be able to drag windows and contacts, the latter being able to drop on a specific window.

Everything is working fine on all browsers I've tried but on iPad a random behaviour occurs when I drag a contact, the window is dragged with it. The contact clone element is always created and the start and stop functions were an attempt to overcome this problem.

Running a bit out of ideas how to work around this!

Gracias por la ayuda!

preguntado el 08 de noviembre de 11 a las 15:11

2 Respuestas

Add this script https://github.com/furf/jquery-ui-touch-punch para reproducirlo en Ipad o Iphone.

Espero eso ayude.

Respondido el 13 de enero de 12 a las 22:01

Thanks for the reply. I am using that one and still have the problem above. I finished the project, so no longer need it, but it might be useful for someone else! Cheers - talkshowhost

Start is when the element starts being dragged, and it has already picked up the .window element at that point. Does mouse down fire before start on the $(".contact") element? I think it will. Try temporarily disabling dragging on .window before dragging starts on .contact.

respondido 17 nov., 11:23

Thanks for the reply! I didn't know about that, but I had tried that already. If I do it like this: $(".contact").mousedown(function (event) { $(".window").draggable("disable");}); and drag the contact first, it works properly, but if I first drag the window and later the contact, then both are dragged. Still better than before, but not ideal. - talkshowhost

There is something strange also happening, that might be simple but I am not getting. On pc browsers, if I put an alert on the mousedown to disable dragging, it always fires, but on the ipad it doesn't always fire... - talkshowhost

There are some information about events on the iPad aquí - Challe

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.