保持AngularJS引导程序弹出窗口作为元素更新可见

时间:2022-06-09 11:22:23

I'm using an AngularJS bootstrap popover on an element using popover-trigger='mouseenter'. The element updates using angularFire, and after an update, the popover disappears until I move my mouse (even within the element).

我正在使用popover-trigger ='mouseenter'在元素上使用AngularJS引导程序弹出窗口。元素使用angularFire更新,更新后,popover消失,直到我移动鼠标(甚至在元素内)。

How can I get the popover to remain visible after an update?

如何在更新后让popover保持可见?

1 个解决方案

#1


1  

When the model updates the directive might be getting reinitiated. Therefore, as the mouse is already over the element and stationary the mouseenter event is not fired.

当模型更新时,指令可能会重新启动。因此,当鼠标已经在元素上并且静止时,不会触发mouseenter事件。

Most likely you will have to edit the popover directive and add a function to the link function which checks the position of the mouse and if the mouse is over the trigger then it will keep the popover visible. However, this might cause flickering.

很可能你必须编辑popover指令并在链接函数中添加一个函数来检查鼠标的位置,如果鼠标在触发器上,那么它将保持popover可见。但是,这可能会导致闪烁。

Or you can silently update the model so that the directive doesn't get reinitiated. If you post some sample code or a jsfiffle/plunker I would be able explain how to do that.

或者您可以静默更新模型,以便不重新启动该指令。如果您发布一些示例代码或jsfiffle / plunker,我将能够解释如何执行此操作。

#1


1  

When the model updates the directive might be getting reinitiated. Therefore, as the mouse is already over the element and stationary the mouseenter event is not fired.

当模型更新时,指令可能会重新启动。因此,当鼠标已经在元素上并且静止时,不会触发mouseenter事件。

Most likely you will have to edit the popover directive and add a function to the link function which checks the position of the mouse and if the mouse is over the trigger then it will keep the popover visible. However, this might cause flickering.

很可能你必须编辑popover指令并在链接函数中添加一个函数来检查鼠标的位置,如果鼠标在触发器上,那么它将保持popover可见。但是,这可能会导致闪烁。

Or you can silently update the model so that the directive doesn't get reinitiated. If you post some sample code or a jsfiffle/plunker I would be able explain how to do that.

或者您可以静默更新模型,以便不重新启动该指令。如果您发布一些示例代码或jsfiffle / plunker,我将能够解释如何执行此操作。