[英]Foundation 6 core js error
我正在使用全新安装的Foundation 6并尝试设置一个可关闭的切换框( http://foundation.zurb.com/sites/docs/toggler.html )。
出于某种原因,我收到此错误但..
Uncaught TypeError: Cannot read property '_init' of undefined
在foundation.core.js的第245行。
这是我页面上的HTML,直接来自Foundation文档中的可关闭示例。
<div class="callout" data-closable>
<button class="close-button" data-close>×</button>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore praesentium sint alias dolorum qui vel quaerat, libero consequatur non esse asperiores veritatis commodi, odit eum ipsam nemo dicta iste aliquam.</p>
</div>
这是我在</body>
之前的HTML底部的javascript。
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/foundation-sites/js/foundation.core.js"></script>
<script src="bower_components/foundation-sites/js/foundation.toggler.js"></script>
<script>
$(document).foundation();
</script>
我不确定我在这里做错了什么或者我错过了什么。 如果我加载整个Foundation javascript库,那么一切都有效,但这对于我需要的内容来说是完全矫枉过正的。
我在Foundation 6中使用多个插件时出现此错误。经过一些搜索和阅读后,发现foundation.core
与foundation.util.mediaQuery
具有共同依赖性。
尝试在foundation.util.mediaQuery
之后插入foundation.core
。
我相信这不适合你,因为你没有动作ui js或css。 包括并尝试,我想你会很高兴。
它实际上是你缺少的foundation.util.motion.js,但仅此一项不会修复它你也需要动作ui css文件。
我有同样的问题,在尝试使用npm(沮丧)解决它后,我只是在我的HTML上导入了JQuery。
转到此链接并复制谷歌CDN
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
并在导入基础脚本之前将其粘贴到html上。 我希望它可以帮助那些仍然有这个问题的人。 干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.