I build this scraping out the answers on stackoverflow. What i want to achive:
For each .element in .element-wrapper add the class .visible with delay 1000ms .
$('.element-wrapper').children('.element').each(function(i) {
var $item = $(this);
setTimeout(function() {
$('.element').addClass('visible');
}, 1000 * i);
});
Actually you are almost right... Just change one line below to make it context sensitive to the current wrapper: