![](/img/trans.png)
[英]Laravel Mix Uncaught ReferenceError: $ is not defined
[英]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.