AngularJS: Button click fired too early in tablet when visible on mouseover -
i have button inside div. button should visible when mouse on div. works on pc mouse. however, on tablet or phone, mouse on event triggered when first touch div. problem if touch place button (although invisible yet), make button visible , trigger click event @ same time. so, how can delay button click event?
here sample code:
<div ng-mouseenter="ismouseover=true" ng-mouseleave="ismouseover=false"> <div>other stuff</div> <button ng-show="ismouseover" ng-click="clicked()">click</button> </div>
you can try unbind click event using jquery. try like:
hml:
<div ng-mouseenter="ismouseover=true" ng-mouseleave="ismouseover=false"> <div>other stuff</div> <button id="beingclicked" ng-show="ismouseover" ng-click="clicked()">click</button> </div>
js (jquery)
//if mobile device if(!!('ontouchstart' in window)){//check touch device $('#beingclicked').off('click'); }
p.s: not tested worth giving atry.
Comments
Post a Comment