var nth_photo_class = "nth-photo"; (function($){ nth = {}; nth.framePhotos = function() { $('.'+nth_photo_class).each(function(i,el){ var selector = 'nth-border-'+($('.nth-borders').length-1); $('.nth-borders.original').clone().insertAfter('.nth-borders.original').removeClass('original').css('display', 'block').addClass(selector); $('.'+selector+' .nth-b1-tl').stw().edge('img:eq('+i+')','tl'); $('.'+selector+' .nth-b1-tr').stw().edge('img:eq('+i+')','tr'); $('.'+selector+' .nth-b1-bl').stw().edge('img:eq('+i+')','bl'); $('.'+selector+' .nth-b1-br').stw().edge('img:eq('+i+')','br'); $('.'+selector+' .nth-b1-t').width($('img:eq('+i+')').width()).stw().edge('img:eq('+i+')','t'); $('.'+selector+' .nth-b1-b').width($('img:eq('+i+')').width()).stw().edge('img:eq('+i+')','b'); $('.'+selector+' .nth-b1-l').height($('img:eq('+i+')').height()).stw().edge('img:eq('+i+')','l'); $('.'+selector+' .nth-b1-r').height($('img:eq('+i+')').height()).stw().edge('img:eq('+i+')','r'); }); } nth.flashPhotos = function() { $('.'+nth_photo_class).each(function(i,el){ $(el).overlay('flash').css('background-color', '#fff'); $(el).overlay('flash').css('background-color', '#fff'); }); } $(window).load(function() { nth.framePhotos(); nth.flashPhotos(); }); })(jQuery);