twitter-bootstrap Bootstrap 在鼠标悬停时显示 div
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45493245/
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
Bootstrap show div on mouse hover
提问by user2972061
回答by MercyDude
There is "Bootstrap Popover Plugin" : https://www.w3schools.com/bootstrap/bootstrap_popover.asp
有“Bootstrap Popover Plugin”:https://www.w3schools.com/bootstrap/bootstrap_popover.asp
like that:
像那样:
<div class="container">
<h3>Popover Example</h3>
<a href="#" title="Header" data-toggle="popover" data-trigger="hover" data-content="Some content">Hover over me</a>
</div>
<script>
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
</script>
Another example on table element: (hover "Savings")
表格元素的另一个例子:(悬停“储蓄”)
回答by Stanley Liu
You can do this with CSS.
你可以用 CSS 做到这一点。
Example HTML:
示例 HTML:
<div id="to-hover">
<div id="to-show"></div>
</div>
Example CSS:
示例 CSS:
#to-show {
display: none;
}
#to-hover:hover > #to-show {
display: block;
}
You may need to change block to inline or some other value depending on the situation. Also you might need to use a different selector than >if they divs have a different relationship.
您可能需要根据情况将块更改为内联或其他值。此外,您可能需要使用不同的选择器,而不是>它们的 div 具有不同的关系。


