Zedric Myers

Simple Little Tricks for Web Transition Touch Events on Mobile Devices

Est. Read Time: ~Keurig Brew-Time

If you want to have a web transition hover event to show on your website for mobile devices, you just need to attach this attribute:

“onclick=”void(0);”

There are multiple ways to do it, but this is a simple way.

If you didn’t want to edit single HTML links for the touch events you can use an event listener.

To do that you simply update your body tag in the HTML to this:

“<body ontouchstart=””>”

If you don’t want to edit your HTML or if you have a lot of pages that need that result you can add this script to your javascript file.

“document.body.addEventListener(‘touchstart’,function(){},false);”

It can also be done with simple CSS “:active” tag appended to the specific element in your CSS file, but in some mobile operating versions it may not work.

Source References: Stackoverflow