Search code examples
androidjquerycsscordovacrosswalk-runtime

Crosswalk Cordova - Click delay not fixed by ontouchstart


Basically, I had a CSS button with :active written, but every time I click on the buttons on my phone, there is a delay before switching to the active phase.

CSS:

.btn {...} .btn:active{...}

Then I tried using "touchstart" and "touchend" to add and remove my active class, but there are still delays between normal -> touchstart and touchstart -> touchend.

Jquery:

$(".btn").on("touchstart", function(){
    $(this).addClass("touched");
}).on("touchend",function(){
    $(this).removeClass("touched");
})

How to remove my delay?


Solution

  • Turns out I did not provide enough information.

    The problem seems to be a Chrome's bug, box-shadow. I removed all the box-shadow properties and it worked like a charm.

    I hope this answer can stay here for others having the same problem. Also, fastclick is not required if you have the meta tag stating width = device width for the newer Chrome.