以下带有模态表单的基本 Foundation 6 设置正在运行。我的意思是,一旦模态表单出现在屏幕上,当我更改浏览器的大小时,它会正确调整大小。
<!doctype html>
<html>
<head>
<title>modal test</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/foundation.min.css">
<script type="text/javascript" src="js/vendor/jquery.min.js"></script>
</head>
<body>
<div id="headerContainer">
<a href="#" class="button" data-open="modalForm">Show Modal</a>
</div>
<div id="modalContainer">
<!-- start: modalForm content -->
<div class="reveal" data-reveal id="modalForm" role="dialog" >
<div class="row" >
<div class="medium-12 large-12 columns">
<p>modal test</p>
<button class="close-button" data-close aria-label="Close reveal" type="button"> <span aria-hidden="true">×</span> </button>
</div>
</div>
</div>
<!-- end: modalForm content -->
</div>
<script src='js/foundation.min.js'></script>
<script>
//$("#modalContainer").load("_form-modal-test.html", function() {
$(document).foundation();
//});
</script>
</body>
</html>
现在,当我将内容放在外部文件中时,像下面的示例一样加载它。模态表单不再正确调整大小。
<!doctype html>
<html>
<head>
<title>modal test</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/foundation.min.css">
<script type="text/javascript" src="js/vendor/jquery.min.js"></script>
</head>
<body>
<div id="headerContainer">
<a href="#" class="button" data-open="modalForm">Show Modal</a>
</div>
<div id="modalContainer"></div>
<script src='js/foundation.min.js'></script>
<script>
$("#modalContainer").load("_form-modal-test.html", function() {
$(document).foundation();
});
</script>
</body>
</html>
任何人都知道如何在动态加载时使模态表单正确响应?