[英]How to get Zurb Foundation's Reveal/Modal to work?
I have a very simple page that simply has the following HTML, copied from the Zurb Foundation site:我有一个非常简单的页面,它只有以下 HTML,从 Zurb Foundation 站点复制:
<p><button class="button" data-open="exampleModal1">Click me for a modal</button></p>
<div class="reveal" id="exampleModal1" data-reveal>
<h1>Awesome. I Have It.</h1>
<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>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
I added JQuery and the Foundation .js and .css files from the CDN:我从 CDN 添加了 JQuery 和 Foundation .js 和 .css 文件:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css">
<script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/js/foundation.min.js"></script>
But the modal still doesn't fire.但是模态仍然没有触发。
I then added Foundation.core.min.js
, with no luck.然后我添加了
Foundation.core.min.js
,但没有运气。 Then foundation.reveal.min.js
also with no result.然后
foundation.reveal.min.js
也没有结果。
I then tried to add a bunch of util .js files然后我尝试添加一堆 util .js 文件
foundation.util.keyboard.js
foundation.util.touch.js
foundation.util.triggers.js
foundation.util.mediaQuery.js
foundation.util.motion.js
Still with no result or errors in the console.控制台中仍然没有结果或错误。
Am I missing something here?我在这里错过了什么吗? What can I do to get it to work?
我该怎么做才能让它发挥作用?
原来你需要在 JS 中初始化 Foundation
$(document).foundation();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.