简体   繁体   English

Angular UI-Bootstrap Popover可拖动

[英]Angular UI-Bootstrap popover draggable

I am using Angular UI-Bootstrap popover and want to make it draggable using jQuery-UI draggable . 我正在使用Angular UI-Bootstrap popover,并希望使用jQuery-UI draggable使它可拖动 It all works as supposed to, but I am having an issue with UI-Bootstrap repositioning. 一切都按预期进行,但是UI-Bootstrap重新定位遇到问题。 If I hover on an element that has tooltip or open another popup, then UI-Bootstrap recalculates the popup placement and puts it to its initial placement. 如果我将鼠标悬停在具有工具提示的元素上或打开另一个弹出窗口,则UI-Bootstrap会重新计算弹出窗口的放置并将其放置到其初始位置。 But I would like it to stay where it was dragged. 但我希望它留在它被拖到的地方。 Is there any workaround on this? 有什么解决方法吗?

My code samples 我的代码样本

HTML HTML

<button type="button" data-uib-tooltip="Toggle tooltip" data-tooltip-placement="bottom auto" data-tooltip-append-to-body="true" data-tooltip-class="hidden-xs" data-uib-popover-template="'popover.tpl.html'" data-popover-append-to-body="false" data-popover-placement="auto left" data-popover-class="popover-default popover-draggable" data-ng-click="vm.makeDraggable()">
    Toggle popover
</button>

JS JS

vm.makeDraggable = function() {
    $('.popover-draggable').draggable();
}

You maybe need to store the last position of the popover. 您可能需要存储弹出框的最后一个位置。 You can use the event drag to get the current position. 您可以使用事件拖动来获取当前位置。

$( ".popover-draggable" ).draggable({
   drag: function( event, ui ) {
    //get position with ui.position
   }
});

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

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