错误-未定义easeInBounce

Error - easeInBounce is not defined

本文关键字:easeInBounce 未定义 错误      更新时间:2023-09-26

我正在尝试使用jQuery宽松函数easeInBounce,我看到了这个错误:

ReferenceError: easeInBounce is not defined

我使用的是jQuery 1.8、Easing 1.3和jQuery UI 1.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});
       });
   });
});

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

希望这能有所帮助。感谢