/ Published in: JavaScript
needs to be modified to be more general purpose.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var CoverUps = { initialized: false, todo: [], initialize: function(thumbnails){ thumbnails.each(function(i){ var image = new Image(); image.onload = function(){ coverup = $('project' + i.id + '_cover-up'); if(coverup){ new Effect.Fade(coverup); }else{ CoverUps.todo.push('project' + i.id + '_cover-up'); } } image.src = i.image; }); Event.observe(document, 'dom:loaded', CoverUps.fadeLeftovers); }, fadeLeftovers: function(){ CoverUps.todo.each(function(e){ new Effect.Fade(e); }); } };