Hello pros from Stackoverflow, I have multiple span elements for which I need to add jquery effects in some order of the elements. I have written a primitive way to do that (like here: JSfiddle).
This is HTML:
<div class="content">
<span id="zoom-1" class="bold">ZOOMING 1</span>
<span id="zoom-2" class="highlight-blue">ZOOMING 2</span>
<span id="zoom-3">ZOOMING 3</span>
</div>
<div class="content">
<span id="zoom-4" class="highlight-grey">ZOOMING 4</span>
<span id="zoom-5">ZOOMING 5</span>
<span id="zoom-6" class="highlight-red bold">ZOOMING 6</span>
</div>
CSS:
.content {
position:relative;
color:#000;
line-height:50px;}
#zoom-1, #zoom-2, #zoom-3, #zoom-4, #zoom-5, #zoom-6 {
position:relative;
margin:0 auto;
font-size:0;
line-height:0;
}
.bold {font-weight:bold;}
.highlight-red {color:red;}
.highlight-blue {color:blue;}
.highlight-grey {color:grey}
.size-10 {font-size:10px;}
.size-20 {font-size:20px;}
.size-30 {font-size:30px;}
JS:
jQuery(document).ready(function(){
$('#zoom-1').animate({
'font-size':'10px'
}, 500,function(){
$('#zoom-2').animate({
'font-size':'30px'
},500,function(){
$('#zoom-3').animate({
'font-size':'20px'
},500,function(){
$('#zoom-4').animate({
'font-size':'20px'
},500,function(){
$('#zoom-5').animate({
'font-size':'10px'
},500,function(){
$('#zoom-6').animate({
'font-size':'30px'
},500);
});
});
});
});
});
});
But as you see, this is a difficult to implement for more than 3 elements this way.
I have defined classes .bold, .highlights and .sizes as future properties for elements and I have tried with .animate() in combination with .addClass() but without success.
Since I have to "animate" more than 20 elements with custom properties for each, can you help me with an advanced but easier to implement solution? I'm looking for a solution IE8+ compatible.
Thank you in advance.