我需要添加scrollmagic。js whit requirejs关于我的项目
我的结构文件是
/js
/app
main.js
/lib
debug.addIndicators.js
jquery.js
require.js
ScrollMagic.js
app.js
requirejs.config({
"baseUrl": "js/lib",
"paths": {
"app": "../app"
},
});
requirejs(["jquery"]);
requirejs(["app/main"]);
requirejs(["ScrollMagic"]);
requirejs(["debug.addIndicators"]);
头脚本加载
<head>
<script data-main="js/app" src="js/lib/require.js"></script>
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="app" src="js/app.js"></script>
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="jquery" src="js/lib/jquery.js"></script>
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="app/main" src="js/lib/../app/main.js"></script>
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="ScrollMagic" src="js/lib/ScrollMagic.js"></script>
</head>
我的主要。js是
define(['jquery'], function() {
jQuery(document).ready(function($) {
jQuery(function() { // wait for document ready
// init controller
var controller = new ScrollMagic.Controller({ loglevel: 3 });
// build scene
var scene = new ScrollMagic.Scene({ triggerElement: "#trigger", duration: 300, loglevel: 3 })
.setPin("#target")
.addIndicators() // add indicators (requires plugin)
.addTo(controller);
});
});
});
我有这个错误,ScrollMagic不起作用
main.js:6 Uncaught ReferenceError: ScrollMagic is not defined
at HTMLDocument.<anonymous> (main.js:6)
at j (jquery.js:2)
at Object.fireWith [as resolveWith] (jquery.js:2)
at ready (jquery.js:2)
我还尝试了在主要中定义更改。js公司
define(['jquery','ScrollMagic','debug.addIndicators'], function() {
检查员中存在相同错误