1

jQueryイージング関数を使用しようとしていますがeaseInBounce、次のエラーが表示されます。

ReferenceError: easeInBounce is not defined

jQuery 1.8、Easing 1.3、jQueryUI1.8.23を使用しています。

これが私のコードです

HTML:

 <div id="loading">
<h2 class="textcenter">Loading...</h2>
 <img id="loading-image" class="center" src="/images/ajax-loader.gif"  />
</div>
<div id="content-wrap" class="hide">
    <div class="img-center">
    <img style="z-index:10" src="/bird-bg.jpg" />
    </div>
    <img class="hide" id="bird" src="/bird.png" />
</div>

CSS:

#bird{
position:absolute;
left:300px;
top: 0px;
z-index:999;
}

.hide {display: none;}

JS:

var $j = jQuery.noConflict();
   $j(window).load(function() {
        $j('#loading').fadeOut('slow', function() {
  $j("#content-wrap").fadeIn("slow", function() {
      $j("#bird").slideDown({ duration: 1000, easing: easeInBounce});
       });
   });
});
4

1 に答える 1

5

Javascript エンジンのこと easeInBounce は変数名です。したがって、それを定義するか、文字列として引用符で囲む必要があります。

  $j("#bird").slideDown({ duration: 1000, easing: 'easeInBounce'});

私が追加した引用を見てください。文字列として機能するはずです。

引用符がなければ、以下のサンプルのように変数を定義する必要がありました。これは、上記の引用符を追加するのと同じことを行います。

  var easeInBounce = 'easeInBounce'; //This would be anywhere before the line where you add the ease in animation

お役に立てれば。ありがとう

于 2012-09-03T22:08:34.603 に答える