简体   繁体   English

UI Bootstrap - 如何在下拉列表打开时防止工具提示打开

[英]UI Bootstrap - how to prevent tooltip opening when dropdown is open

I have a dropdown that is triggered by clicking a glyphicon. 我有一个通过单击glyphicon触发的下拉列表。 The glyphicon has a ui-bootstrap tooltip that is triggered on mouse-enter/mouse-leave. glyphicon具有ui-bootstrap工具提示,在鼠标输入/鼠标离开时触发。 The tooltip is also triggered to close when the glyphicon is clicked, and the dropdown is shown. 单击glyphicon时,也会触发工具提示关闭,并显示下拉列表。

However, once the dropdown is open, the tooltip is shown again if the mouse-enter is triggered. 但是,一旦打开下拉列表,如果触发鼠标输入,则会再次显示工具提示。 I would like to prevent the mouse-enter triggering the tooltip when the dropdown is open. 我想在下拉列表打开时阻止鼠标输入触发工具提示。

The html for the glyphicon and the dropdown is: glyphicon和下拉列表的html是:

<span class="" uib-dropdown-toggle>
    <span class="glyphicon glyphicon-sort category-sort-icon" uib-tooltip="Sort"
        tooltip-placement="left" tooltip-is-open="sortTooltipIsOpen"
        ng-click="sortTooltipIsOpen = !sortTooltipIsOpen">
    </span>
</span>

<ul uib-dropdown-menu class="dropdown-menu-right">
    <li ng-repeat="s in sortDesc" ng-click="sortBy(s)"><a href="#">{{s}}</a></li>
</ul>

I've create a plnkr to show exactly how it working: http://plnkr.co/edit/aeOuJasEHFUH505o2L8T 我创建了一个plnkr来准确显示它是如何工作的: http ://plnkr.co/edit/aeOuJasEHFUH505o2L8T

Any ideas how to do this? 任何想法如何做到这一点?

Here is the working plnkr . 这是工作的plnkr I have used "is-open" attribute to detect whether dropdown is open or not. 我使用“is-open”属性来检测下拉列表是否打开。 Based upon that, I have disabled/enabled the tooltip. 基于此,我已禁用/启用工具提示。 I hope it helps. 我希望它有所帮助。

I have added tooltip-enable="!isDropdownOpen" to the tooltip and is-open="isDropdownOpen" to the uib-dropdown. 我已将tooltip-enable =“!isDropdownOpen”添加到工具提示,并将is-open =“isDropdownOpen”添加到uib-dropdown。

<span class="" uib-dropdown is-open="isDropdownOpen">

        <span class="" uib-dropdown-toggle>

            <span class="glyphicon glyphicon-sort category-sort-icon" uib-tooltip="Sort"
              tooltip-placement="left" tooltip-is-open="sortTooltipIsOpen"
              ng-click="sortTooltipIsOpen = !sortTooltipIsOpen" tooltip-enable="!isDropdownOpen" >
            </span>

        </span>

        <ul uib-dropdown-menu class="dropdown-menu-right">
            <li ng-repeat="s in sortDesc" ng-click="sortBy(s)"><a href="#">{{s}}</a></li>
        </ul>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM