The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to get HTML5 drag and drop work on touch devices

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #43098


    I have started making a game with the HTML5 drag and drop. I tried it on my iPad and iPhone and did not work. This is a small part of my existing code;

    $(‘.characters’).bind(‘dragstart’, function(e){
    e.dataTransfer.setData(‘text’, $(this).attr(‘id’));
    position = $(this).parent().attr(‘id’);
    if ($(this).attr(‘class’) == turn) {
    console.log(‘carry on’);
    }else( console.log(“it is not your turn”) );
    In order to at touch events. Would I have to manipulate the above code so that it works for both, mouse and touch. Or to I have to create the touch script separately from the above. Or should I not use the HTML5 API at all and go for a js library that might have all the required gestures I need.

    This project started as a way for me to learn HTML5 drag and drop, so is this API limited only for the mouse?

    hope you can put me in the right direction



    Check out this drag and drop engine. It has lots of really useful features and it works well on touch devices:

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.