Question

I am attempting to use jQuery easing function easeInBounce and I see this error:

ReferenceError: easeInBounce is not defined

I am using jQuery 1.8, Easing 1.3 and jQuery UI 1.8.23.

Here is my code

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});
       });
   });
});
Was it helpful?

Solution

Javascript engine things easeInBounce is a variable name. So you either have to define it or put it in quotes as a string.

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

Look at the quotes I added. It should work as a string.

Without the quotes you would have had to define the variable as the sample below, which does the same as adding the quotes as above.

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

Hope this helps. Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top