gpt4 book ai didi

jquery - bootstrap - 在模态标题中覆盖弹出框

转载 作者:太空宇宙 更新时间:2023-11-04 08:58:57 25 4
gpt4 key购买 nike

我试图在模态标题中添加叠加弹出框。但是当显示弹出窗口时,弹出窗口会忽略其原始位置。

HTML

<div id="myModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<div class="pull-right">
<div class="overlay">
<a class="btn"
rel="popover"
href="#"
name="link-menu"
data-content="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. "
data-original-title="A Title"
data-placement="bottom">
popover menu
</a>
</div>
</div>
<h3>What is Lorem Ipsum?</h3>
</div>
<div class="modal-body">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>

<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>

CSS

.overlay {
position: relative;
background-color: rgba(0, 0, 0, 0);
}

.overlay.on {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10;
}

这是我能够实现的目标的 fiddle 。 http://jsfiddle.net/rjrimorin/p6BAD/50/

非常感谢任何帮助!谢谢!

最佳答案

Updated FIDDLE

从覆盖类中删除 position: relative 并将 position: fixed 更改为 position: static for .overlay.on

$('a[rel=popover]').popover();

$("a[name='link-menu']").click(function() {
$("div.overlay").toggleClass("on");
});
.btn{
margin-right: 5px;
}

.overlay {
position: relative;
background-color: rgba(0, 0, 0, 0);
}
.overlay.on {
position: static;
top: 0;
left: 0;
height: 100%;
width: 100%;

z-index: 10;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<div class="pull-right">
<div class="overlay">
<a class="btn"
rel="popover"
href="#"
name="link-menu"
data-content="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. "
data-original-title="A Title"
data-placement="bottom">
popover menu
</a>
</div>
</div>
<h3>What is Lorem Ipsum?</h3>
</div>
<div class="modal-body">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>

<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>

关于jquery - bootstrap - 在模态标题中覆盖弹出框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42905368/

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