【发布时间】:2021-09-07 09:35:31
【问题描述】:
【问题讨论】:
-
嗨。欢迎来到 SO!请访问help center,转至tour,查看what 和How to Ask。做一些研究,搜索关于 SO 的相关主题;如果您遇到困难,请发布您尝试的minimal reproducible example,注意输入和预期输出,最好在Stacksnippet
标签: javascript html button popup mapbox
【问题讨论】:
标签: javascript html button popup mapbox
你能发布你的代码吗?至少是html代码。这应该在弹出窗口中添加按钮。
这类似于我认为您在图像中显示的内容。它被称为来自https://www.w3schools.com/css/css_tooltip.asp 的工具提示。我添加了按钮的代码。如果没有您的代码,我们将无法确切知道您在寻找什么。
<!DOCTYPE html>
<html>
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
bottom: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
<body style="text-align:center;">
<h2>Top Tooltip</h2>
<p>Move the mouse over the text below:</p>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
<button onclick="myFunction()">Click me</button>
</div>
</body>
</html>
你的 JavaScript:
function myFunction{
alert("Add your code here");
}
【讨论】: