window.addEvent('domready', function() { $$('.detail-wrapper').slide('hide'); $$('.slide-wrapper').each(function(item) { var slideSinopse = new Fx.Slide(item.getElement('.sinopse-wrapper'), { duration: 500 }); var slideDetail = new Fx.Slide(item.getElement('.detail-wrapper'), { duration: 500 }); item.getElement('.sinopse-wrapper').addEvent('click', function() { slideSinopse.cancel(); slideSinopse.cancel(); slideSinopse.slideOut().chain(function() { slideDetail.slideIn(); }); }); item.getElement('.exit-wrapper').addEvent('click', function() { slideSinopse.cancel(); slideSinopse.cancel(); slideDetail.slideOut().chain(function() { slideSinopse.slideIn(); }); }); }); });