bootstrap-5 - 添加更多内容时,Bootstrap 5 弹出窗口失败
问题描述
当我将文件缩减为以下内容时,我的弹出框按预期工作:
HTML
<html>
<head>
<link rel="stylesheet" href="path/to/bootswatch/file.css">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<button
class="testButton"
data-bs-toggle="popover"
data-bs-placement="top"
title="Some title"
data-bs-content="Some content">
My Test Button
</button>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="script.js"></script>
</body>
</html>
JavaScript
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
CSS(所以我的弹出框顶部有空间)
.testButton {
margin-top: 200px;
}
其中大部分是从我在网上找到的文档中复制的。但是,当我在按钮下添加足够的内容时,它会消失:
<button
class="testButton"
data-bs-toggle="popover"
data-bs-placement="top"
title="Some title"
data-bs-content="Some content">
My Test Button
</button>
<h1>Lorem........</h1>
<h1>Lorem........</h1>
<h1>Lorem........</h1>
<h1>Lorem........</h1>
<h1>Lorem........</h1>
<h1>Lorem........</h1>
谁能告诉我这是为什么以及如何解决?
解决方案
推荐阅读
- javascript - 由于客户函数,Lambda 执行失败,状态为 200,错误任务超时
- ios - iOS - 损坏的 iMessage 链接共享
- java - 无法在 Visual Studio 代码上将 Gradle 版本 7.0.2 与 java 11 一起使用
- pine-script - 基于用户输入的每日开/关限制
- asp.net - Asp.net Web 表单(非 MVC)天蓝色活动目录身份验证
- vue.js - Vue警告:属性或方法未在实例上定义,但在渲染期间引用
- python - 有没有办法只按1次就可以让方块连续移动?
- spring-boot - Spring Cloud 配置服务器 git 连接问题
- javascript - 合并两个 JavaScript 对象,添加数字而不是替换它们
- c - 为什么这段代码涉及数组和指针的行为如此?