Skip to content
Advertisement

How to make a div disappear when someone uses a touch screen device?

I’m trying to make an div which follows your cursor but I want it to like, disappear if someone uses a touch screen device. Is it possible to do this with only CSS or plain JAVASCRIPT?

JavaScript

This is my code but I have no idea how to make it disappear with touch screen devices as I said.

Any Ideas?

Advertisement

Answer

Use touchstart/touchend events:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement