C
C
Cpa2018-02-28 22:50:48
JavaScript
Cpa, 2018-02-28 22:50:48

How to distinguish a mouse click from a touch screen click?

For example code

<script>
function who(){
if (если клик сделан мышкой,то есть устройство десктоп)
if(если клик сделан тачем,то есть с телефона)
}
</script>
<a href="" onclick="who();">WHOIS</a>

How to correctly determine what the click was from and process it accordingly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2018-02-28
@politon

You get a device using, for example, https://github.com/matthewhudson/current-device
And by condition you set the desired action for click

V
Vladislav Lyskov, 2018-03-01
@Vlatqa

what input

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question