Reputation: 7316
I'm using this code:
<!-- language: lang-js -->
$(document).ready(function() {
$("#Arrow_Down_Mobile , #Arrow_Down_Mobile_other").click(function() {
doBounce($(this), 10, '10px', 300);
});
function doBounce(element, times, distance, speed) {
for (var i = 0; i < times; i++) {
element.animate({
marginTop: '-=' + distance
}, speed).animate({
marginTop: '+=' + distance
}, speed);
}
}
});
It works perfectly fine, however I'm trying to change the behavior from click()
so that it can start playing immediately once the page loads.
I've tried ready
, live()
, trigger()
, on()
, load()
etc. yet none of them play the animation right away so I'm running out of ideas here as to how to get this animation to work other than by clicking on it.
Upvotes: 1
Views: 31