[英]How to get Zurb Foundation's Reveal/Modal to work?
我有一个非常简单的页面,它只有以下 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>
我从 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>
但是模态仍然没有触发。
然后我添加了Foundation.core.min.js
,但没有运气。 然后foundation.reveal.min.js
也没有结果。
然后我尝试添加一堆 util .js 文件
foundation.util.keyboard.js
foundation.util.touch.js
foundation.util.triggers.js
foundation.util.mediaQuery.js
foundation.util.motion.js
控制台中仍然没有结果或错误。
我在这里错过了什么吗? 我该怎么做才能让它发挥作用?
原来你需要在 JS 中初始化 Foundation
$(document).foundation();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.