I have this function that fades out each div apart from the one that has been clicked on. At the moment they all fade out at the same time, but I would like them to fade out one at a time.
I would also like the divs to fade out in a random order so extra points to anyone who can tell me how!
$(".grid-item").click(function () {
var selected = this;
$('.grid > div').not(selected).each(function(i) {
$(this).fadeTo(200, 0, function(){
$(this).css("visibility", "hidden");
});
});
});
This is a bit lengthy, but I like it because it uses a recursive function to randomize the delay of the fades: