gpt4 book ai didi

javascript - Bootstrap 弹出窗口中参数容器的用法?

转载 作者:可可西里 更新时间:2023-11-01 02:36:22 25 4
gpt4 key购买 nike

在我在互联网上发现的大多数情况下,container 被设置为 'body'

我遇到的:

bootstrap popover 显示在固定的 div 内容上,当您滚动页面时,popover 也会移动。

我将参数容器更改为我的特定 DIV #search-filter-container,没有任何变化。

更新:

现在 .popover 即使我设置了 container: '#some-my-div',DIV 终于出现在 body 中了

  <div class="popover fade right in" style="top: 429.5px; left: 680px; display: block;">
code details...
</div>
</body>

最佳答案

很难知道您在问什么,尤其是因为您没有提供任何代码示例。请阅读How do I ask a good question?

但是,为了向您展示容器选项用法的示例,我创建了一个 JSFiddle .

注释掉每一行 javascript 以查看不同的效果(在结果框架 中上下滚动)。更改代码时不要忘记按运行

HTML

<div style="height: 100px;">
<br />Static text.</div>
<div style="position: fixed; width: 100%;" id="fixed-div">
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus
sagittis lacus vel augue laoreet rutrum faucibus." id="popover">Popover</button>
</div>
<div style="height: 2000px;"></div>

Javascript

// comment this
$('[data-toggle="popover"]').popover({container: "body"});

// uncomment this
//$('[data-toggle="popover"]').popover({container: "#fixed-div"});

关于javascript - Bootstrap 弹出窗口中参数容器的用法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23881423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com