Hope someone can help i cant seem to get my head around this, i would like to load the jquery animation onload and let it to bounce unlmited number of times instead of having to click it.
Also it seems to bounce all my divs?
Any ideas here is what i have so far:
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<style type="text/css">
.bulb {
margin: 0px;
width: 65px;
height: 65px;
position: relative;
background-image: url(img/bulb.png);
}
</style>
<script>
$(document).ready(function() {
$("div").click(function () {
$(this).effect("bounce", { times:500 }, 500);
});
});
</script>
</head>
<div class='bulb'></div>
<div>Dont Bounce</div>
</body>
</html>
If you want to bounce the element unlimited times, you have to create a function which calls itselved after the function is finished.
See my jsfiddle
Give the element you want to bounce a certain class, in my case ‘bounce’ to only bounce this element.
So your html:
And your jquery
PS. I don’t advice to do this, it’s distracting, could be possible dangerous because it loops endlessly.