none
[UWP][JS]Dragging is not working through Touch in UWP javascript application RRS feed

  • Question

  • Hi,

    We are trying to Drag any div using "jquery-Ui.js" and "touch-punch.js".

    But the Dragging is not working through touch on touchscreen monitors.

    Here is my sample code:

    HTML:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link href="css/default.css" rel="stylesheet" />
        <script src="js/jquery1.6.2.js"></script>
        <script src="js/jquery-ui.js"></script>
        <script type="text/javascript" src="js/jquery.ui.touch-punch.min.js"></script>
        <script src="js/main.js"></script>
    </head>
    <body>
        <div class="main">
            <div class="test" style=";height:100px;width:100px;background-color:black; color:#fff;text-align:center;border:1px solid red;">
                drag it!!
             <div>
        </div>
    </body>
    </html>

    JavaScript:

    $(function () {
        $(".test").draggable();
    });

    Is there any way to make the dragging working with touch in UWP (javascript) application?


    Wednesday, July 4, 2018 1:13 PM

All replies

  • You can try javascript code from following github project

    https://github.com/elvisxia/TestRepo/tree/9613b0c5244104ba880d77243c706ae0d9acb98c/DragAndDropSample(JS)


    Gaurav Khanna | Microsoft MVP | Microsoft Community Contributor

    Wednesday, July 4, 2018 2:26 PM
  • Hi

    Thanks Gaurav,

    Tried to use the above code. but, didn't worked out for me.

    Any other solution for this?

    Thursday, July 5, 2018 10:39 AM
  • Hi,

    What's the OS version of your device? Is there any other device that you made a test on?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 6, 2018 9:44 AM
  • Hi Roy,

    I have Windows 10 Pro version 1803.

    Tried to run the application on other device as well. but, faced same issue.That dragging is not working

    Regards,

    Ashwin

    Friday, July 6, 2018 11:39 AM
  • Hi,

    WinJS should support pointer event. But from the JS code, it seems that you are using a third party library for touch event. We could not help with such problem with a third party for some policy.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 11, 2018 1:12 AM