我正在尝试使用Foundation来使揭密模式起作用。当我点击下面的链接时,没有任何反应。当我加载页面时,会显示模态中的内容,但看起来很奇怪。
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foundation for Sites</title>
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<div class="row">
<div class="large-12 columns">
<h1>Welcome to Foundation</h1>
<a href="#" data-reveal-id="myModal">Click Me For A Modal</a>
<div id="myModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 id="modalTitle">Awesome. I have it.</h2>
<p class="lead">Your couch. It is mine.</p>
<p>I'm a cool paragraph that lives inside of an even cooler modal. Wins!</p>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
</div>
</div>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/what-input.js"></script>
<script src="js/vendor/foundation.min.js"></script>
<script src="js/app.js"></script>
<script>
$('#myModal').foundation('open')
</script>
</body>
</html>
答案 0 :(得分:1)
您使用的是Foundation 6个例子吗?
而不是data-reveal-id
,使用data-open
或data-toggle
定位您的曝光:
<a href="#" data-open="myModal">Click Me For A Modal</a>
<a href="#" data-toggle="myModal">Click Me For A Modal</a>