PDA

View Full Version : JS Looping through divs in a master div to set opacity.



andriusain
February 16th, 2009, 05:37 PM
Hello all. I'm not at all versed with javascrip but since is quite similar to AS3, which I have been learning for the last three months I have an understanding of how it works.

I need your help with the following: I have around thirty divs inside a master div. These divs contain each one a dot image of a dotted line. I want to create an animation with this dots so each one will set its opacity from 0 to 1 a tenth of a second one after the other. I know this should be very simple to do with a loop but I don't know how to loop through the divs inside a master div.

I have a few lines of code from jquery to set opacity but other than that I dont know what to do.


$(document).ready(function(){

$(".div1").animate({opacity: "-400"}, 1)
.animate({opacity: "0.01"}, 1000)
.animate({opacity: "1"}, 2000)
});

Any help would be, as always, really appreciated.

Thanks Kirupians!