Questions tagged [ontouchstart]
14 questions
1
vote
1 answer
Replace passive addEventListener to onTouchStart method
I want to replace document.addEventListener('touchstart', handler, {passive: true}); to onTouchStart={handler}
So if I had passive flag on true then my handle method should like:
const handler = (event) => {
console.log(event);
}
and when I…

Aleksandra
- 21
- 1
- 1
- 4
1
vote
0 answers
why ontouchstart event triggers the handler twice in react?
I observed this weird behaviour that when using ontouchstart, the event handler is triggered twice but when I switched to onclick, it was triggered once. Why is it like this?

Blake
- 7,367
- 19
- 54
- 80
0
votes
1 answer
React OnClick/onTouchStart not working on real mobile touchscreen while working on desktop browser mobile simulator
I have a simple button tag on a next.js main page.js file that alerts the window after clicking. The onClick function works on any desktop browser but doesn't work on any mobile browser.
"use client";
export default function Page() {
return (
…

Amir B
- 28
- 5
0
votes
0 answers
Using onclick and ontouchstart events in an image
I have been working on geolocation of a user in leaflet map and I'm loving the experience with leaflet. Everything works except when the same map is viewed on a mobile phone, the "getPosition" function does not work when the image is touched on…

Madea
- 25
- 4
0
votes
1 answer
How to ensure onblur event before ontouchstart
Our in-house web app uses onblur to capture user input and onmouseup to act on it. We had problems with the onblur event not always triggering before onclick, so I changed that to onmouseup (although, it would seem that onclick can be combined with…

Bob Nemec
- 366
- 1
- 3
- 10
0
votes
0 answers
Hover bug in Safari mobile cured by adding ontouchstart (!!)
I am experiencing some very strange behaviour with :hover on li in mobile Safari (iPad).
Randomly :hover doesn't fire on some of the li's and this random behaviour actually changes over time - esp after a screen rotation.
Amazingly adding…

ellismp
- 1
0
votes
1 answer
Problems with touchstart event
I'm building a dynamic section on a website. When you click or touch the name of one activity, a pop-up displays with the name of that activity and some information.
I've used vanilla JS with one click event and one touchstart event. It works fine…

Gonzalo Alcina
- 3
- 3
0
votes
0 answers
Can I use both "onmousedown" and "ontouchstart" for a button?
I have a html
which calls functions with onmousedown="down();" and onmouseup="up();". Holding the button down activates an interval loop, so it's about holding the button pressed and clearing the interval when mouse comes up.
Now…

im-not-a-robot
- 3
- 2
0
votes
1 answer
ontouchstart acting weird on mobile devices?
I am working on a game and i am using ontouchstart as a way to handle au ser tapping on the screen. but when i click on the screen it does not register the first time, it makes me click it twice for it to register even one click. I have no idea…

Pylot
- 233
- 2
- 16
0
votes
1 answer
Audio being skipped during fast ontouch IOS
I have created a flip tile memory game. A sequence of tiles will flip over displaying a colour. The user must remember the sequence and repeat it. When the user selects correctly a correct Mp 3 is played. On the Iphone if the tiles are selected…

Lily Rawlings
- 33
- 5
0
votes
1 answer
Invoking/calling a modal using a "ontouchstart" event
In a button, a modal is called using data-target of a button, but here since I have a touch screen I want to use ontouchstart (when touched on button, not clicked) to call the modal.
Any suggestion how can I implement this?
This is how I am calling…
0
votes
1 answer
Javascript touch events are not getting triggered
I am running a hybrid app on an android device (Moto G5 plus/android 8). The touch events are not working on it. The same app when installed on other android devices(Android 6/7/8/9) works just fine.
I tried all the touch events(touchstart,…

Diwakar Narayan
- 3
- 2
0
votes
1 answer
ontouchstart not working on Windows 8 Tablet
I'm trying to get ontouchstart working for windows tablet. If detected it disables the top layer of my links so that a click event allows the menu to remain open (instead of a hover effect).
The following code is working on other touch devices so…

Dan Lee
- 684
- 4
- 15
- 35
0
votes
1 answer
If touch, else if click, else
Any way to differentiate between touch and click? "Why on earth would you want to?" Always someone that thinks they know every possible use case, so to you:
We have a muti-tiered drop down nav menu. If a user is on a regular laptop with a mouse,…

Y.K.
- 290
- 2
- 9