ipad drag and drop

后端 未结 6 1657
误落风尘
误落风尘 2021-01-31 12:09

I need to implement drag and drop for Ipad.

I tried this solution: http://www.gotproject.com/blog/post2.html

But since I am using JQuery myself, it conflicts and

6条回答
  •  野的像风
    2021-01-31 12:51

    Confirmed that furf's jquery-ui-touch-punch works on the iPad.

    Getting it to work is as easy as including "jquery.ui.touch-punch.js" after you've included jquery-ui and jquery itself. For example:

    HTML:

    
        
        
    
        
        
    
    

    Javascript:

    //
    // assume that html_string is a valid string
    // containing some element you want to be draggable
    // which needs to be added to the DOM
    //
    function addItemToUIList (list, html_string) {
        var item = $(list).append (html_string);
    
        // now, using jqui and touch-punch, we can make it draggable
        item.draggable ();
    }
    

    Now "item" can be dragged around on screen on the ipad as well as in chrome on the desktop.

提交回复
热议问题