我正在尝试使用zurb基金会5显示模式。但它不工作,当我点击按钮时,它不会打开。我正在使用这个html代码。
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link type="text/css" rel="stylesheet" href="css/foundation.css" />
<link type="text/css" rel="stylesheet" href="css/normalize.css" />
<title>index</title>
</head>
<body>
<div id="myModal" class="reveal-modal" data-reveal>
<h2>Awesome. I have it.</h2>
<p class="lead">Your couch. It is mine.</p>
<p>Im a cool paragraph that lives inside of an even cooler modal. Wins</p>
<a class="close-reveal-modal">×</a> </div>
<a class="button" href="#" data-reveal-id="myModal">Click for a modal</a>
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation/foundation.js"></script>
<script src="js/foundation/foundation.reveal.js"></script>
<script type="text/javascript">
$('#myModal').foundation();
</script>
</body>
</html>发布于 2014-01-13 13:01:56
将最后一个脚本标记更改为:
<script type="text/javascript">
$(document).foundation();
</script>发布于 2014-12-28 17:00:13
您还忘记添加模式触发器:
<a href="#" data-reveal-id="myModal">Click Me For A Modal</a>请参阅此处的文档:http://foundation.zurb.com/docs/components/reveal.html
发布于 2021-04-21 09:21:18
如果您在同一页面上调用了两次$(document).foundation();,则可能会遇到此问题。
https://stackoverflow.com/questions/21059419
复制相似问题