您好我尝试在固定定位的父元素中使用bootstrap模式。 但似乎它没有按预期工作。 这是一个例子,
<div class="fixed">
<div>
<div>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-target="#myModal" data-toggle="modal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
https://codepen.io/anon/pen/yMPOpo
注意:我希望保持HTML结构不变。
答案 0 :(得分:2)
问题是什么?它不可点击?
尝试将模态设置为position:relative并为其指定z-index。
见这里: https://codepen.io/anon/pen/wJPWdr
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var openUrl:NSURL? //This is used when to save state when App is not running before the url trigered
func application(_ application: UIApplication, openURL url: NSURL, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//print("Host: \(url.host!)")
//let url = url.standardized
//NotificationCenter.default.post(name: NSNotification.Name(rawValue: "HANDLEOPENURL"), object:url!)
print("bbb")
return true
}
}
答案 1 :(得分:1)
简短回答:删除fixed
类
Codepen:https://codepen.io/anon/pen/dvZXVG
此处有同样问题的问题:z-index not working with fixed positioning
或MDN文档:The stacking context
答案 2 :(得分:1)
你只需要降低模态背景的z-index,
尝试这个简单的CSS,你很高兴
.modal-backdrop{
z-index:-1;
}