I’m trying to loop an animation of each object bouncing one after another and then bouncing in the opposite direction – piano roll style.
I’m at a loss as to why this code doesn’t function.
<script type=text/javascript>
$.fn.exBounce = function(){
var self = this;
(function runEffect(){
self.delay(500).effect("bounce", { direction:'down', times:1 }, 200);
})();
};
function animatebounce() {
$(".bounce").each(function(i) {
$(this).delay(500 * i).exBounce(function(){
$($(".bounce").get().reverse()).each(function(i) {
$(this).delay(200 * i).exBounce();
});
});
});
};
$(document).ready(function(){
animatebounce();
});
@asawilliams is right.
You need to define callback as a paramater in your plugin and then call it
http://jsfiddle.net/gaboesquivel/ZRZEA/7/