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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:18:34+00:00 2026-06-02T09:18:34+00:00

Using phonegap, jquery. Is it possible to detect touches on two different elements at

  • 0

Using phonegap, jquery.
Is it possible to detect touches on two different elements at the same time ?

I’m creating something that requires two images ( button-left and button-right ) to be pressed
at the same time before another event it triggered.

The following is not an exhaustive list of code, but should provide insight into what im trying to achieve

<head>

<script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
<script type="text/javascript" charset="utf-8" src="jq.js"></script>
<script type="text/javascript" src="jquery.stopwatch.js"></script>

<script>
    var w = new Stopwatch(updatedisplay, 50);
    var onoff = false;

    $("#button-left, #button-right").unbind("touch",begin);

    function begin() {
        onoff = true;
        w.start();
    }

    function end() {
        w.stop();
        onoff = false;
    }       

    function updatedisplay(watch) {
        var mills = parseInt(watch.getElapsed().milliseconds/10);
        if(mills<10) {
            millis = '0'+mills;
        } else {
            millis = mills;
        }
        document.getElementById('counterValue').innerHTML = watch.toString() + "." + millis;
    }

    function reset() {
        w.stop();
        onoff = false;
        document.getElementById('counterValue').innerHTML = "00:00:00.00";
    }
</script>
</head>

<body onload="onBodyLoad()">
  <div id="counterValue">
    00:00:00.00
  </div>
  <div id="button-left"></div>
  <div id="button-right"></div> 
</body>

::::: CREATED THIS FIX ::::: A BIT UGLY BUT IT WORKS BRILLIANTLY :::::

I found another way around, now this might be a bit ugly.. but it works well …

    $(document).ready(function() {                          
       document.getElementById('button-left').addEventListener('touchstart', nofunc(e), false);
       document.getElementById('button-right').addEventListener('touchstart', nofunc(e), false);
    });

    function vala(val) {
        av = val;
        checkvals();
    }
    function valb(val) {
        bv = val;
        checkvals();
    }
    function checkvals() {
        if(av == 1 && bv == 1) {
            if(onoff == false) {
                begin();
            } else {
                end();
            }
        }
    }

   <div id="button-left" ontouchstart="vala(1)" ontouchend="vala(0)">&nbsp;</div>
   <div id="button-right" ontouchstart="valb(1)" ontouchend="valb(0)">&nbsp;</div> 
  • 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-06-02T09:18:37+00:00Added an answer on June 2, 2026 at 9:18 am

    as above, i found a way to do what i needed… a bit of “reading of manuals” and i came up with this

    $(document).ready(function() {                          
       document.getElementById('button-left').addEventListener('touchstart', nofunc(e), false);
       document.getElementById('button-right').addEventListener('touchstart', nofunc(e), false);
    });
    
    function vala(val) {
        av = val;
        checkvals();
    }
    function valb(val) {
        bv = val;
        checkvals();
    }
    function checkvals() {
        if(av == 1 && bv == 1) {
            if(onoff == false) {
                begin();
            } else {
                end();
            }
        }
    }
    

     
     

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

Sidebar

Related Questions

I'm creating an native Android application by using PhoneGap and jQuery Mobile. When I
I am creating a web app using jQuery Mobile and PhoneGap. There is a
I'm creating a mobile application using jQuery mobile and PhoneGap. When the application is
I am using phonegap + jquery mobile and have a submit function that works
I am creating an application in phonegap using the jQuery mobile framework. In my
I am using phoneGap and jQuery Mobile . When I use a <div></div> tag
I'm using Phonegap and Jquery Mobile on an Android app. I need to save
I have some strange scrolling problems with my PhoneGap (using jQuery Mobile) app: I'm
I am using PhoneGap, jQuery mobile in Xcode. I have a local xml (data.xml)
I have an application made by using phonegap 1.5.0 and jquery mobile 1.1.0.... I

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.