How to vibrate when touching the screen on js? | Sololearn: Learn to code for FREE!

0

How to vibrate when touching the screen on js?

4/9/2021 12:46:52 AM

Novruz Bazarov

5 Answers

New Answer

-1

https://code.sololearn.com/WdWh5WX7BXzy/?ref=app

+3

ontouchstart=()=>{navigator.vibrate(1000)}

+3

Adding to ŚĄŃ [Exams], you may need to check for support on some devices. Most ios don't support the navigator's object. if(windows.navigator && windows.navigator.vibrate) { // insert san's code here } ; Wondering why there's a -1 on san's CORRECT answer tho

+2

vibrate only could works on roughly phone/tablet devices... if supported, this could be achieved with navigator.vibrate() function, by providind accurate argument: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate

0

seriously? best answer mark first set to my answer, then set to ŚĄŃ [Exams] answer wich only provide example of example of how to apply what I provided the how to, after I provided how to use what I give you the way to do iit? that's not fair... all the more when it doesn't explain how this works, and he had upvoted my answer ^^ that's not the way to convince me to try to help you and others to learn ;P