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
|
addLoader: function(){
this.MooFlow.store('height', this.MooFlow.getSize().y);
this.loader = new Element('div',{'class':'loader'}).inject(this.MooFlow);
new Fx.Tween(this.MooFlow, {
'duration': 800,
'onComplete': this.preloadImg.bind(this)
}).start('opacity', 1);
},
preloadImg: function(){
this.loadedImages = new Asset.images(this.getMooFlowElements('src'), {
'onComplete': this.loaded.bind(this),
'onProgress': this.createMooFlowElement.bind(this)
});
},
createMooFlowElement: function(counter, i){
var obj = this.getCurrent(i);
var img = this.loadedImages[i];
obj['width'] = img.width;
obj['height'] = img.height;
img.removeProperties('width','height');
obj['div'] = new Element('div').setStyles({
'position':'absolute',
'display':'none',
'height': this.MooFlow.getSize().y
}).inject(this.MooFlow);
obj['con'] = new Element('div').inject(obj['div']);
img.setStyles({'vertical-align':'bottom', 'width':'100%', 'height':'50%'});
img.addEvents({'click': this.clickTo.bind(this, i), 'dblclick': this.viewCallBack.bind(this, i)});
img.inject(obj['con']);
new Element('div').reflect({ 'img': img,
'ref': this.options.reflection,
'height': obj.height,
'width': obj.width,
'color': this.options.bgColor
}).setStyles({'width':'100%','height':'50%','background-color': this.options.bgColor}).inject(obj['con']);
this.loader.set('text', (counter+1) + ' / ' + this.loadedImages.length);
},
loaded: function(){
this.index = this.options.startIndex;
this.iL = this.master.images.length-1;
new Fx.Tween(this.loader, {
'duration': 800,
'onComplete': this.createUI.bind(this)
}).start('opacity', 0);
}, |
Partager