function el var arr bg_body1 img2 arr length eff fadeIn fadeOut Math r

1
2
3
4
5
6
7
8
9
(function(el){
var arr = ['bg_body1', 'img2'], l = arr.length, eff = ['fadeIn', 'fadeOut'], k = 1, i = Math.round(Math.random()*(l - 1));
el[0].height(el[1].css('background', 'url(/images/' + arr[0] + '.jpg) center top no-repeat').height());
(function(){
el[(m = (i = (++i % l))%2)].css('background', 'url(/images/' + arr[i] + '.jpg) center top no-repeat')[ eff[k ^= 1] ](2000);
el[m ^= 1][ eff[k ^= 1] ]( 2000 );
setTimeout(arguments.callee, 3000 );
})();
})([$("#bg1"), $("#bg")]);