2017-02-12 9 views
1

ScrollMagicの最新バージョンで私に以下のエラーが表示されるのはなぜですか? ScrollMagic - Uncaught ReferenceError:ScrollSceneが定義されていません

Uncaught ReferenceError: ScrollScene is not defined

この

この guide次の私のテストコードです:

私はこの最新バージョンを使用していた場合
$(function() { 
    // Init Controller 
    var scrollMagicController = new ScrollMagic(); 

    // Create Animation for 0.5s 
    var tween = TweenMax.to('#animation', 0.5, { 
     backgroundColor: 'rgb(255, 39, 46)', 
     scale: 7, 
     rotation: 360 
    }); 

    // Create the Scene and trigger when visible with ScrollMagic 
    var scene1 = new ScrollScene({ 
     triggerElement: '#scene', 
     offset: 150 /* offset the trigger 150px below #scene's top */ 
    }) 
    .setTween(tween) 
    .addTo(scrollMagicController); 

    // Add debug indicators fixed on right side 
    scene1.addIndicators(); 
}); 

<script src="//cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js"></script> 
<script src="//cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/plugins/debug.addIndicators.min.js"></script> 

フルエラー:

Uncaught ReferenceError: ScrollScene is not defined 
    at HTMLDocument.<anonymous> (basic.php:66) 
    at c (jquery.min.js:3) 
    at Object.fireWith [as resolveWith] (jquery.min.js:3) 
    at Function.ready (jquery.min.js:3) 
    at HTMLDocument.H (jquery.min.js:3) 

しかし、このverを使うとシオンとそれが正常に動作します(私は推測する古い):

<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/1.3.0/jquery.scrollmagic.js"></script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/1.3.0/jquery.scrollmagic.debug.js"></script> 

マイHTML:

<div class="post"> 
     <span class="glyphicon glyphicon-grain"> </span> 
     <h2> Lorem ipsum dolor sit amet, consetetur sadipscing elitr</h2> 
    </div> 

    <div class="post" id="scene"> 
     <span class="glyphicon glyphicon-lamp" id="animation"> </span> 
     <h2> Lorem ipsum dolor sit amet, consetetur sadipscing elitr</h2> 
    </div> 

任意のアイデアなぜですか?私はgithubから、このガイドを使用する場合

EDIT

// Init Controller 
var scrollMagicController = new ScrollMagic.Controller(); 

// Create Animation for 0.5s 
var tween = TweenMax.to('#animation', 0.5, { 
    backgroundColor: 'rgb(255, 39, 46)', 
    scale: 7, 
    rotation: 360 
}); 

// Create the Scene and trigger when visible with ScrollMagic 
var scene1 = new ScrollMagic.Scene({ 
    triggerElement: '#scene', 
    offset: 150 /* offset the trigger 150px below #scene's top */ 
})janpaepke-ScrollMagic/scrollmagic/minified/plugins/debug.addIndicators.min.js 
.setTween(tween) 
.addTo(scrollMagicController); 

// Add debug indicators fixed on right side 
scene1.addIndicators(); 

を私はこのエラーが発生します。

Uncaught TypeError: (intermediate value).setTween is not a function 
    at HTMLDocument.<anonymous> (basic.php:70) 
    at c (jquery.min.js:3) 
    at Object.fireWith [as resolveWith] (jquery.min.js:3) 
    at Function.ready (jquery.min.js:3) 
    at HTMLDocument.H (jquery.min.js:3) 

なぜ????!彼らが持っているドキュメントはひどいです!

EDIT 2:私も多くのエラーが発生します

<script src="libs/janpaepke-ScrollMagic/js/lib/greensock/TweenMax.min.js"></script> 
<script src="libs/janpaepke-ScrollMagic/scrollmagic/minified/plugins/animation.gsap.min.js"></script> 

<!-- should be replaced with minified version when development is finished --> 
<script src="libs/janpaepke-ScrollMagic/scrollmagic/minified/plugins/jquery.ScrollMagic.min.js"></script> 

<!-- should be removed when development is finished --> 
<script src="libs/janpaepke-ScrollMagic/scrollmagic/minified/plugins/debug.addIndicators.min.js"></script> 

だから私は、ダウンロードしたバージョンを使用

jquery.ScrollMagic.min.js:2 Uncaught TypeError: Cannot read property '_util' of undefined 
    at jquery.ScrollMagic.min.js:2 
    at jquery.ScrollMagic.min.js:2 
    at jquery.ScrollMagic.min.js:2 
(anonymous) @ jquery.ScrollMagic.min.js:2 
(anonymous) @ jquery.ScrollMagic.min.js:2 
(anonymous) @ jquery.ScrollMagic.min.js:2 
debug.addIndicators.min.js:2 Uncaught TypeError: Cannot read property '_util' of undefined 
    at debug.addIndicators.min.js:2 
    at debug.addIndicators.min.js:2 
    at debug.addIndicators.min.js:2 
(anonymous) @ debug.addIndicators.min.js:2 
(anonymous) @ debug.addIndicators.min.js:2 
(anonymous) @ debug.addIndicators.min.js:2 
basic.php:65 Uncaught ReferenceError: ScrollMagic is not defined 
    at HTMLDocument.<anonymous> (basic.php:65) 
    at c (jquery.min.js:3) 
    at Object.fireWith [as resolveWith] (jquery.min.js:3) 
    at Function.ready (jquery.min.js:3) 
    at HTMLDocument.H (jquery.min.js:3) 

ファイル名やフォルダ構造は完全に混乱しています。混乱し、一貫性がない!

答えて

1

gsapプラグインもインポートする必要があります。スクロールマジックフォルダを確認してください。 animation.gsap.min.js

+0

スクロールマジックフォルダから 'animation.gsap.min.js'を追加した後のエラー(私の編集2を参照)。ファイル名とフォルダ構造は完全に混乱しています。混乱し、一貫性がない! – laukok

1

はそれが役立つはず

new $.ScrollMagic.Scene 

代わりの

new ScrollMagic.Scene 

を使用してみてください。 バージョン1.3.0を使用している場合、 '$'なしで動作します。

関連する問題