1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
function AnimateBanner(banner, name, tab, width, url)
{
this.banner = banner;
this.name = name;
this.tab = tab;
this.url = url;
this.width = width;
this.box = new Array();
this.ispartial = true;
}
AnimateBanner.prototype =
{
init : function (nbW, nbH, partial, vertical)
{
this.nbH = nbH;
this.nbW = nbW;
for (var h = 0; h < nbH; h++)
{
this.banner.append('<div id="banner_h_' + h + '" style="overflow: auto; width: '+ this.width * this.nbW +';"></div>');
if(partial != null)
{
if((h < Math.round(nbH / 2))&& (vertical == '1')) {
this.banner.append('<div class="partial">' + partial+'</div>');
this.ispartial = false;
}
}
for (var w = 0; w < nbW; w++)
{
this.banner.find('#banner_h_' + h).append('<div style="display : inline; float: left; width="' + this.width + '""'
+ ' id="banner_h_' + h + '_w_' + w + '"> </div>');
if(partial != null)
{
if((w < Math.round(nbW / 2))&& (vertical == '0')) {
this.banner.find('#banner_h_' + h).append('<div style="float: left;" class="partial">' + partial+'</div>');
this.ispartial = false;
}
}
}
}
},
animate : function (time, effect, getBox)
{
var wait = 0;
for (var h = 0; h < this.nbH; h++)
{
var temp = new Array();
for (var w = 0; w < this.nbW; w++)
{
var box = this.banner.find('#banner_h_' + h + '_w_' + w);
var animateBox = new (getBox(w,h))(box, this.name + ".box[" + h + "][" + w + "]", this.tab, this.width, this.url);
animateBox.init(time, effect, wait);
wait += 1000;
temp.push(animateBox);
}
this.box.push(temp);
}
}
} |
Partager