L84*_*L84 1 javascript jquery jquery-easing
我试图使用jQuery缓动函数easeInBounce,我看到这个错误:
ReferenceError: easeInBounce is not defined
Run Code Online (Sandbox Code Playgroud)
我正在使用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>
Run Code Online (Sandbox Code Playgroud)
CSS:
#bird{
position:absolute;
left:300px;
top: 0px;
z-index:999;
}
.hide {display: none;}
Run Code Online (Sandbox Code Playgroud)
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});
});
});
});
Run Code Online (Sandbox Code Playgroud)
Javascript引擎的东西easeInBounce是一个变量名.因此,您必须定义它或将其作为字符串放在引号中.
$j("#bird").slideDown({ duration: 1000, easing: 'easeInBounce'});
Run Code Online (Sandbox Code Playgroud)
看看我添加的报价.它应该作为一个字符串.
如果没有引号,您必须将变量定义为下面的示例,这与添加上面的引号相同.
var easeInBounce = 'easeInBounce'; //This would be anywhere before the line where you add the ease in animation
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.谢谢