简体   繁体   中英

Making a function call onclick whenever I touch

I use joystick.js . My aim is for whenever I touch ( ontouchstart ) it will call onclick .

I tried this below but it didn't work. My joystick is preventing me from touch buttons. I even replaced onclick with ontouchstart but I use jQuery. I can't change all. For any idea I would be grateful.

document.getElementById("overlyas").ontouchstart = function(e){         
   var ontouchstart = onclick;
}

As a work around for ios not recognising the onclick event you can in your main css file set the cursor to pointer:

* {
    cursor: pointer;
}

then it will register onclick events. I think it only recognises onmousedown by default.

Not sure if this actually answers your question but it saved me a lot of trouble with writing hybrid apps....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM