admin管理员组文章数量:1334133
Right now I'm detecting if the user's browser has touch events and listening for touchend
instead of click
on certain elements (to get over the 'wait-for-double-click' lag). It works great on a slide-out drawer I'm using.
I want to modify my app so that elements with ng-click="function()"
will respond on click
events for desktop (no touch events available) and respond on touchend
for touch devices.
I'd rather not create a new directive for ng-touch
or something and instead just modify the ng-click
directive. I'm not sure how to modify a built-in Angular directive, though.
Is there a way to do this?
Here's a rough JS fiddle I started, but didn't get too far:
/
Right now I'm detecting if the user's browser has touch events and listening for touchend
instead of click
on certain elements (to get over the 'wait-for-double-click' lag). It works great on a slide-out drawer I'm using.
I want to modify my app so that elements with ng-click="function()"
will respond on click
events for desktop (no touch events available) and respond on touchend
for touch devices.
I'd rather not create a new directive for ng-touch
or something and instead just modify the ng-click
directive. I'm not sure how to modify a built-in Angular directive, though.
Is there a way to do this?
Here's a rough JS fiddle I started, but didn't get too far:
http://jsfiddle/MTh8U/
Share Improve this question asked Jan 7, 2014 at 4:41 KeithKeith 4,2247 gold badges28 silver badges43 bronze badges1 Answer
Reset to default 7It actually sounds like you're trying to duplicate what Angular has already created for mobile: http://docs.angularjs/api/ngTouch. Note that this is just another dependency you'll need to inject.
本文标签: javascriptIn AngularJS how can I modify ngclick to fire on touchEnd on mobileStack Overflow
版权声明:本文标题:javascript - In AngularJS how can I modify ng-click to fire on touchEnd on mobile? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742358884a2459962.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论