基础揭示:foundation.core.js:190 TypeError:无法读取未定义的属性'register'

问题描述 投票:0回答:2

我已经安装了基础6,到目前为止所有看起来都工作正常。现在我想添加一个揭示模式。添加了jQuery v2.2.4并从FOUNDATION_VERSION ='6.2.1'加载了必要的库,如下所示:

<script src="/assets/js/foundation.core.js" type="text/javascript"></script>
<script src="/assets/js/foundation.util.mediaQuery.js" type="text/javascript"></script>
<script src="/assets/js/foundation.reveal.js" type="text/javascript"></script>
<script>
    $(document).foundation();
</script>
</body>

然后从基金会网站添加了示例模式:

<p><a data-open="exampleModal1">Click me for a modal</a></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">&times;</span>
    </button>
</div>

加载页面时,我看到一个控制台日志错误:

foundation.core.js:190 TypeError:无法读取undefined的属性'register'

我试图加载选项卡库并再次复制示例html但出现同样的问题。

javascript html zurb-foundation
2个回答
4
投票

经过一些挖掘后,似乎揭示还有进一步的依赖:

<script src="/assets/js/foundation.util.keyboard.js" type="text/javascript"></script>
<script src="/assets/js/foundation.util.box.js" type="text/javascript"></script>
<script src="/assets/js/foundation.util.triggers.js" type="text/javascript"></script>

包含这些额外的库后,问题得到了解决。


0
投票

这是我揭示模态的确切包含

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation-float.css"/>
<link rel="stylesheet" href="styles/styles.css"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
<link href="https://fonts.googleapis.com/css?family=Merriweather|Raleway" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.core.js"></script> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/foundation.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.reveal.js"></script> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.util.keyboard.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.util.triggers.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.util.mediaQuery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/plugins/foundation.util.motion.js"></script>
© www.soinside.com 2019 - 2024. All rights reserved.