I think I know just enough about jQuery to get me in trouble. I have three continuous animations that I am happy with. But now need them to run sequentially and repeat. I am unsure about queuing or settimeout. Think I just need to rewrite and combine but not sure the best approach. Simplified my code into a JSFIDDLE.
$(document).ready(function() {
var $pulse = $('.a');
function runIt() {
$pulse.animate({margin:"0 0 0 150px",opacity:"1"}, 1100)
.animate({margin: "100px 0 0 150px",opacity:"0"}, 1400,
function() {
$pulse.removeAttr("style");
runIt();
});
}
runIt();
});
//
$(document).ready(function() {
var $pulse = $('.b');
function runIt() {
$pulse.animate({margin:"100px 0 0 150px",opacity:"1"}, 1100)
.animate({margin: "200px 0 0 150px",opacity:"0"}, 1400,
function(){$pulse.removeAttr("style");
runIt();
});
}
runIt();
});
//
$(document).ready(function() {
var $pulse = $('.c');
function runIt() {
$pulse.animate({margin:"200px 0 0 150px",opacity:"1"}, 1100)
.animate({margin: "300px 0 0 150px",opacity:"0"}, 1400,
function(){$pulse.removeAttr("style");
runIt();
});
}
runIt();
});