繁体   English   中英

如何修复未捕获的 ReferenceError:未定义 TimelineMax

[英]How to fix Uncaught ReferenceError: TimelineMax is not defined

我的 JS 文件:

const logo = document.querySelector("#logo");
const tl = new TimelineMax({});
tl.fromTo(logo, 1, {height: "0%"}, {height: "80%"});

我的 CSS 文件:

#logo{
width: 100%;
height: 100%;
position: absolute;
top: 200px;
z-index: -1;
}

我的 HTML 文件:

<!DOCTYPE html>
<html lang= "es">
    <head>
        <title>Quark</title>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="Style.css">
    </head>
    <body>
        <div class="Limg">
            <img id="logo" src= "Logo.svg">
        </div>
        <script src="animaciones.js"></script> 
        <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js" integrity="sha512-DkPsH9LzNzZaZjCszwKrooKwgjArJDiEjA5tTgr3YX4E6TYv93ICS8T41yFHJnnSmGpnf0Mvb5NhScYbwvhn2w==" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TimelineMax.min.js" integrity="sha512-0xrMWUXzEAc+VY7k48pWd5YT6ig03p4KARKxs4Bqxb9atrcn2fV41fWs+YXTKb8lD2sbPAmZMjKENiyzM/Gagw==" crossorigin="anonymous"></script>
    </body>
</html>

而且我不知道问题出在哪里,已经尝试使用不同的版本,但什么也没有

将您的脚本标签移动到 header 上的最大时间线

<head>
    <title>Quark</title>
    <meta charset="UTF-8" />
    <link rel="stylesheet" href="Style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js" integrity="sha512-DkPsH9LzNzZaZjCszwKrooKwgjArJDiEjA5tTgr3YX4E6TYv93ICS8T41yFHJnnSmGpnf0Mvb5NhScYbwvhn2w==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TimelineMax.min.js" integrity="sha512-0xrMWUXzEAc+VY7k48pWd5YT6ig03p4KARKxs4Bqxb9atrcn2fV41fWs+YXTKb8lD2sbPAmZMjKENiyzM/Gagw==" crossorigin="anonymous"></script>
 </head>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM