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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -