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 6336909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:08:59+00:00 2026-05-24T19:08:59+00:00

JavaScript executes for a computer but not for a iPad. I am not sure

  • 0

JavaScript executes for a computer but not for a iPad.
I am not sure if there is another gesture. But when I touch and drag an item on the Browser it should move, it does on the computer, but it moves the whole screen on the iPad. Do I need to rewrite gestures in JavaScript… and how?

None of the gestures seem to be working the way they do on the computer for the iPad.

//global variables
var obj,x,y,dx,dy;
// set up draggable elements
function Setup(){
    //exit if the browser doesn't support the DOM
    if (!document.getElementsByTagName) return;
    divs=document.getElementsByTagName("DIV");
    for (i=0; i<divs.length;i++){
        if (divs[i].className != "drag") continue;
        //set event handler for each div with class="drag"
        divs[i].onmousedown=Drag;
    }
}
function Drag(e){
    //Start dragging an object
    if (!e) var e = window.event;
    //which object was clicked?
    obj=(e.target) ? e.target: e.srcElement;
    obj.style.borderColor="red";
    //calculate object offsets from mouse position
    dx=x-obj.offsetLeft;
    dy=y-obj.offsetTop;
}
function Move(e){
    //track mouse movements
    if (!e) var e =window.event;
    if (e.pageX){
        x=e.pageX;
        y=e.pageY;
    }else if (e.clientX){
        x = e.clientX;
        y = e.clientY;
    }else return;
    if (obj){
        obj.style.left=x-dx;
        obj.style.top=y-dy;
    }
}
function Drop(){
    //let go!
    if (!obj) return;
    obj.style.borderColor="black";
    obj=false;
}
//Detect mouse movement
document.onmousemove = Move;
//drop current object on mouse up
document.onmouseup = Drop;
//set up when the page loads
window.onload = Setup;
  • 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-24T19:09:00+00:00Added an answer on May 24, 2026 at 7:09 pm

    This happens because the iPad/iPod Touch/iPhone/etc is a touch interface to start with. To navigate a large page you need to be able to touch and drag the screen around. vonconrad has a great explanation about this issue here.

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

Sidebar

Related Questions

I have an application where the html/javascript code executes fine in a standalone browser
I have a javascript that executes within a element like : <a href=javascript:doSomething();> but
I was just wondering at what point the browser executes JavaScript when it comes
Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL
how do I automatically execute javascript? I know of <body onLoad=> , but I
Is there a way to specify some JavaScript to execute on the OnBlur event
I am trying to emulate a web browser in order to execute JavaScript code
I'm seeing a lot of answers on StackOverflow that say that JavaScript executes code
I want to be able to write javascript that executes on a page that
Possible Duplicate: $(document).ready equivalent without jQuery I have a framework-less javascript that executes on

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.