720kb / angular-tooltips

Angularjs tooltips module, add tooltips to your elements - https://720kb.github.io/angular-tooltips
351 stars 157 forks source link

Hide tooltips for touchscreen #192

Closed mbirnbaum closed 7 years ago

mbirnbaum commented 7 years ago

I only want my tooltips to show with mouse interactions. If it is a touch screen, I do not want it to show. The default show-trigger is mouseover. But this is also showing the tooltips when I touch. What setting should I use to disable tooltips on touchscreen?

45kb commented 7 years ago

@mbirnbaum i'd check via javascript if it's a touchscreen or not and then use tooltip-hidden="true" in case

scope.tooltipHidden = false;
angular.element($window).on('touchstart', function () { scope.tooltipHidden = true; });
<span ng-controller="ctrl as MyCtrl">
<a tooltips tooltip-template="hello" tooltip-hidden="ctrl.tooltipHidden">tooltip</a>
</span>
mbirnbaum commented 7 years ago

Where would I add this? in the tooltipsConfProvider?

45kb commented 7 years ago

@mbirnbaum Controller and view

Not in config or it will be hidden even on normal screens, just switch it in the view

mbirnbaum commented 7 years ago

But, I use the tooltips all over my app. There's no global setting for this?

45kb commented 7 years ago

You can but if you add it to the config provider it will be the same configuration both for touch and normal screens.

I'd make a little global find&replace in view files.

45kb commented 7 years ago

@mbirnbaum try also tooltip-hide-trigger="touchstart dbclick"

mbirnbaum commented 7 years ago

tooltip-hide-trigger="touchstart dbclick" does nothing. showing tooltips on iPad.

45kb commented 7 years ago

there is no such feature or option specific to touchscreens, you can even use css to show or hide tooltips, just hack around and/or use tooltip-hidden nope?