javascript - Fade out divs one at a time using JQuery -
i have function fades out each div apart 1 has been clicked on. @ moment fade out @ same time, them fade out 1 @ time.
i divs fade out in random order points 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"); }); }); });
var selected; var fader = function() { $('.grid > div').not(selected).not(':hidden').first().fadeout(200, fader); }; $(".grid-item").click(function () { selected = this; fader(); }); for randomness, have at:
http://blog.mastykarz.nl/jquery-random-filter/
please give me bonus points.
Comments
Post a Comment