Tuesday, 15 February 2011

javascript - jQuery fade in child after child -



javascript - jQuery fade in child after child -

for reason, know possible without using selectors or classes or identifiers, cant figure out.

i have divs nested in other divs , want fade each 1 in, 1 after other, shallowest div deepest div.

i though .each() or .children() cant figure out. i'm not sure how written.

but, reason, have strong feeling, accomplished short simple script, can help me figure out?

here's fiddle should more understandable. http://jsfiddle.net/3z9bf/

don't allow fiddle confuse though. not trying .fadein first div began writing script myself when realized couldn't myself.

here's simple plugin:

$.fn.cascadechildren = function (speed) { var $children = this.children(); if ( ! $children.length ) return; speed = speed || 300; $children.animate({ opacity: 1 }, speed, function () { $(this).cascadechildren(speed); }); };

use follows:

$('#element').cascadechildren();

here's fiddle: http://jsfiddle.net/gufzc/

javascript jquery html fadein children

No comments:

Post a Comment