![](/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.