twitter-bootstrap Bootstrap Popover 父级?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13316699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 15:41:15  来源:igfitidea点击:

Bootstrap Popover parent?

javascripttwitter-bootstrap

提问by Brian

I'm trying to get a popover to be inserted into a specific element, since at the moment, the popover is being insert straight into <body>(and I need it relative to some other elements). However, I can't seem to find how to get the popover to be inserted into a certain element? How can I trigger this?

我正在尝试将弹出框插入到特定元素中,因为目前,弹出框正在直接插入<body>(并且相对于其他一些元素我需要它)。但是,我似乎无法找到如何将弹出框插入某个元素?我怎样才能触发这个?

Edit: I have found that using "inside" in the placement options will insert it into the element that triggered it. This is close, but I need a way to insert it a bit higher up in the DOM.

编辑:我发现在放置选项中使用“内部”会将其插入到触发它的元素中。这很接近,但我需要一种方法将它插入到 DOM 的更高位置。

回答by Yohn

You can update your tooltip.js to this file - my tooltip.jsand then select the the element you want to the popover to be appened to by either adding data-container=".element"or with javascript

您可以将您的 tooltip.js 更新到此文件 -我的 tooltip.js,然后通过添加data-container=".element"或使用 javascript选择您想要添加到弹出窗口的元素

$(element).popover({ container: '.popover-holder' })

$(element).popover({ container: '.popover-holder' })

回答by sja87

another script for bootstrap partent hover option

bootstrap partent 悬停选项的另一个脚本

https://github.com/sja87/bootstrap-tooltip-parent

https://github.com/sja87/bootstrap-tooltip-parent