【问题标题】:fullpage is not a constructor issuefullpage 不是构造函数问题
【发布时间】: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。之后包括您的自定义脚本。现在您正在尝试执行尚未加载的代码
  • 好的。这很尴尬。非常感谢。
  • 如果您认为该评论有帮助,请点赞 :)

标签: javascript fullpage.js


【解决方案1】:

我找到了解决办法。

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

是必需的。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
  • 对我不起作用
猜你喜欢
  • 2019-05-09
  • 1970-01-01
  • 2023-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多