【发布时间】:2020-06-25 07:46:06
【问题描述】:
我总是遇到同样的问题,目前我不知道出路。 以下问题:
我尝试为我的网站使用整页。这是我正在做的简化版本:
<!DOCTYPE html>
<html lang="de">
<head>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/fullpage.min.css">
</head>
<body>
<div id="fullpage">
<section class="section" id="home">
<h2>Home</h2>
</section>
<section class="section" id="project">
<h2>Project</h2>
</section>
<section class="section" id="contact">
<h2>Contact</h2>
</section>
</div>
<script src="js/jsApplication.js"></script>
<script src="js/fullpage.min.js"></script>
<script src="js/jquery-3.4.1.min.js"></script>
</body>
我的“jsApplication.js”的内容:
new fullpage('#fullpage', {
licenseKey: 'OPEN-SOURCE-GPLV3-LICENSE',
autoScrolling: true,
});
我总是收到以下错误:“TypeError: fullpage is not a constructor”。 那么我做错了什么?
最好的问候
【问题讨论】:
-
您的脚本顺序不正确,首先您需要加载您的依赖项,例如 jQuery 和 Fullpage。之后包括您的自定义脚本。现在您正在尝试执行尚未加载的代码
-
好的。这很尴尬。非常感谢。
-
如果您认为该评论有帮助,请点赞 :)