Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6789867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:39:24+00:00 2026-05-26T17:39:24+00:00

I implemented the simple webview app through android to point to an html file

  • 0

I implemented the simple webview app through android to point to an html file which will be used to drag and drop icons like a simple puzzle game. I used the jquery draggable and droppable libraries to implement on the html-side, but when I pulled it up on the webview, it didn’t work. After searching the forums, I tried several fixes and none of them worked. I think that this post could be the answer, but it also didn’t work out: Javascript Drag and drop for touch devices. Although, I don’t think I implemented it properly, since I just added it on to the code which uses the draggable/droppable from jquery.ui.

Here’s the draggable/droppable code:

 $(document).ready(function() {
    init(); 
 $( "#draggable" ).draggable({
            snap:"#droppable", snapMode: "inner", revert: "valid"});
    $( "#droppable" ).droppable({
        drop: function( event, ui ) {
            $( this )
                .addClass( "ui-state-highlight" )
                .find( "p" )
                    .html( "Dropped!" );
        },
        out: function( event, ui ) {
            $( this )
                .removeClass( "ui-state-highlight" )
                .find( "p" )
                    .html( "Drop here" );
        }
    });
  });

here’s the touch handler implementation:

 function 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 init()
{
document.addEventListener("touchstart", touchHandler, true);
document.addEventListener("touchmove", touchHandler, true);
document.addEventListener("touchend", touchHandler, true);
document.addEventListener("touchcancel", touchHandler, true);    
}

In the body of the html, I am using divs to call out the draggable and droppable.
Not sure why it’s not working…any guidance would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:39:25+00:00Added an answer on May 26, 2026 at 5:39 pm

    Ok, so after struggling with this for a while, I came across this link which does something similar, but allows for the touch-based drag and drop. Hope it is useful to you.
    http://www.stevefenton.co.uk/Content/Jquery-Mobile-Drag-And-Drop/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented a simple C# application which inserts about 350000 records into the database.
I have implemented a simple file upload-download mechanism. When a user clicks a file
I've implemented a simple calendar (message system) for my game which consists from: 1)
I've implemented a simple WPF splash screen window which informs the user about the
I have implemented a simple close() method for all the Backbone views which disposes
I am working on a simple notification service that will be used to deliver
I've implemented a simple Observer pattern in a hello world style app. I've got
I wrote an android app, which requires large amount of data to be transfered
I am trying to implement a simple android app with forms inside it. I
I've currently implemented a simple asset manager, which allows me to manage CSS and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.