如何在iPad上解雇uib-tooltip-html

时间:2016-07-23 21:25:18

标签: html angularjs

我在使用AngularJS uib-tooltip-html实现的HTML页面上有一个工具提示:

<div>
    <i uib-tooltip-html="myTooltip='my tooltip HTML'"
       class="fa fa-exclamation-triangle"></i>
</div>

当我用鼠标悬停图标时,它在桌面浏览器上显示良好,当鼠标在图标区域外时消失。

当我在iPad上激活工具提示时,如果我点击其他屏幕区域,它就不会消失。

如何解除iPad上的uib-tooltip-html工具提示?

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题并找到了解决方案。希望这有助于其他人寻找答案。将以下代码添加到您的网站:

$('[data-toggle="popover"]').popover(); // close on body click 
// iOS doesnt recognise 'body' click so using :not 
$(':not(#anything)').on('click', function (e) { 
    $('[data-toggle="popover"]').each(function () { 
        if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { 
            $(this).popover('hide'); 
        } 
    });
});

URL

的所有归功于 stelco
相关问题