The drag and drop question type simply doesn't work on most mobile, neither Android nor iOS.

Comments

jvdkolk’s picture

As a workaround, you could install the http://drupal.org/project/js_injector

And then add a js injector rule for your closed question nodes (or for all nodes) having the following code:

function drupal_cq_touchHandler(event)
{
 var touches = event.changedTouches,
    first = touches[0],
    type = "";

     switch(event.type)
{
    case "touchstart": type = "mousedown"; break;
    case "touchmove":  type="mousemove"; break;        
    case "touchend":   type="mouseup"; break;
    default: return;
}
var simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1,
                          first.screenX, first.screenY,
                          first.clientX, first.clientY, false,
                          false, false, false, 0/*left*/, null);

first.target.dispatchEvent(simulatedEvent);
event.preventDefault();
}

function drupal_cq_touchHandler_init()
{
   document.addEventListener("touchstart", drupal_cq_touchHandler, true);
   document.addEventListener("touchmove", drupal_cq_touchHandler, true);
   document.addEventListener("touchend", drupal_cq_touchHandler, true);
   document.addEventListener("touchcancel", drupal_cq_touchHandler, true);    
}

drupal_cq_touchHandler_init();

(inspired by http://stackoverflow.com/questions/5186441/javascript-drag-and-drop-for-...)

If I get Git up and running again, I will try to include this in the 7.x dev branch.

jvdkolk’s picture

Version: 7.x-2.1 » 7.x-2.x-dev
Assigned: Unassigned » jvdkolk
Priority: Critical » Major
Status: Needs review » Active
jvdkolk’s picture

Status: Active » Needs review

This should be fixed in the 7.x-2.x-dev i just pushed. Users should add the jQuery ui touch punch library, as stated in the README.txt

* To enable drag & drop / select&order questions on touch screen devices:
Put jQuery UI Touch Punch in sites/all/libraries/jquery-ui-touch-punch
get it from: http://touchpunch.furf.com/
This should result in the file and directory:
sites/all/libraries/jquery-ui-touch-punch/jquery.ui.touch-punch.js

Please review.

jvdkolk’s picture

Status: Needs review » Closed (fixed)

Tested it myself on my Android phone. Works. Because iPhones use the same webkit engine and because I don't care too much about Windows Phones :p, I'll close this issue.

tebser’s picture

What made I wrong?
I tried to implement the feature for mobile drag and drop.
Here is a sample page:
www.elearnlinks.com/satzschema_0001

Please help!
------------------

A have found the answer! Another module was the problem.

tebser’s picture

Status: Closed (fixed) » Active
tebser’s picture

Status: Active » Closed (fixed)