HTML Drag And Drop On Mobile Devices

后端 未结 8 919
栀梦
栀梦 2020-11-29 16:28

When you add drag and drop to a web page using JavaScript, such as jQuery UI draggable and droppable, how do you get this to work when viewed via a browser on a mobile devic

相关标签:
8条回答
  • 2020-11-29 16:52

    here is my solution:

    $(el).on('touchstart', function(e) {
        var link = $(e.target.parentNode).closest('a')  
        if(link.length > 0) {
            window.location.href = link.attr('href');
        }
    });
    
    0 讨论(0)
  • 2020-11-29 16:53

    jQuery UI Touch Punch just solves it all.

    It's a Touch Event Support for jQuery UI. Basically, it just wires touch event back to jQuery UI. Tested on iPad, iPhone, Android and other touch-enabled mobile devices. I used jQuery UI sortable and it works like a charm.

    http://touchpunch.furf.com/

    0 讨论(0)
提交回复
热议问题