繁体   English   中英

Laravel Mix:未捕获ReferenceError:未定义ScrollMagic

[英]Laravel Mix: Uncaught ReferenceError: ScrollMagic is not defined

我正在使用UI并尝试与GSAP一起实现scrollmagic ,我首先在加载时实现了GSAP动画,并且对我来说就像是魅​​力,但是当我尝试通过Scrollmagic实现GSAP ,我在控制台中遇到了此错误。

未捕获的ReferenceError:未定义ScrollMagic

有关更多信息,我在package.json文件中添加了依赖项

"dependencies": {
        "gsap": "^1.20.4",
        "scrollmagic": "^2.0.5"
    }

然后将其导入到app.js

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');
require('gsap');
require('scrollmagic');
require('./custom');

/*window.Vue = require('vue');*/

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

/*Vue.component('example-component', require('./components/ExampleComponent.vue'));

const app = new Vue({
    el: '#app'
});*/

然后在我的home.blade.php

$(document).ready(function () {
            let scrollMagicController = new ScrollMagic();
            let showHeader = TweenMax.from('.menu-container',0.5,
                {
                    opacity:0,
                    width: "100%",
                    ease:Power1.easeOut
                });
            let showHeaderTrigger = new ScrollScene({
                triggerElement: '.about-us-section',
                triggerHook:"onCenter"
            }).setTween(showHeader)
                .addTo(scrollMagicController);
        });

您的帮助将不胜感激。

谢谢 :)

尝试

global.ScrollMagic = require('scrollmagic');

暂无
暂无

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

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