/ Published in: JavaScript
needs to be modified to be more general purpose.
Expand |
Embed | Plain Text
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); }); } };
Comments
Subscribe to comments
You need to login to post a comment.

sample initialization: CoverUps.initialize([{id: 41, image: '/uploads/images/descriptions/thumbnails/featured/fea-thumb-21240849366.jpg'}, {id: 40, image: '/uploads/images/descriptions/thumbnails/featured/fea-thumb-11240848400.jpg'}, {id: 15, image: '/uploads/images/descriptions/thumbnails/featured/fea-thumb-21240846805.jpg'}]);