Currently, I am checking if the user's browser supports touch events and listening for touchend
instead of click
on specific elements to avoid any delay when waiting for a double-click. This method works effectively on a slide-out drawer in my project.
I am looking to update my application so that elements with ng-click="function()"
will respond to click
events on desktops (without touch capability) and touchend
events on touch-enabled devices.
Instead of creating a new directive like ng-touch
, I would prefer to modify the existing ng-click
directive. However, I am unsure of how to go about changing a built-in Angular directive.
Is there a way to achieve this without creating a separate directive?
Below is a preliminary JS fiddle I started but did not make much progress: