我正在使用 Twitter Bootstrap 创建一些弹出窗口。 是否可以匹配例如两个弹出窗口到一个按钮并通过单击该按钮同时调用这两个弹出窗口?
最佳答案
two popovers to one single button
看起来很难,但是,
call both at the same time by clicking on the button
会好的。
尝试
- 用元素包围按钮或在按钮旁边放置一个“空白”元素。
- 然后在同一个按钮上调用元素弹出框。
代码如下
<span id="popover1Span"><button type="button" class="btn" id="myButton">Double</button></span>
<span id="popover2Span"> </span>
<script type="text/javascript">
$(document).ready(function() {
$("#myButton").click(function() {
$(this).popover({
title : "Popover 1",
content : "Popover 1.",
html : true,
trigger : "manual",
placement : "bottom"
}).popover('toggle');
$("#popover1Span").popover({
title : "Popover 2",
content : "Popover 2.",
html : true,
trigger : "manual",
placement : "top"
}).popover('toggle');
$("#popover2Span").popover({
title : "Popover 3",
content : "Popover 3.",
html : true,
trigger : "manual",
placement : "right"
}).popover('toggle');
});
});
</script>
关于button - 一键多个弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17444988/