/**
- * List of images
+ * Array of images Roo.Elements (which should be images)
+ * properties can be
*/
imageArray: false,
this.resizeSpeed = Math.min(this.resizeSpeed, 10);
this.resizeSpeed = Math.max(this.resizeSpeed, 1);
- this.resizeDuration = this.animate ? ((11 - this.resizeSpeed) * 0.15) : 0;
- this.overlayDuration = this.animate ? 0.2 : 0; // shadow fade in/out duration
+ this.resizeDuration = this.animate ? ((11 - this.resizeSpeed) * 0.15) : 0;
+ this.overlayDuration = this.animate ? 0.2 : 0; // shadow fade in/out duration
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
// If animations are turned off, it will be hidden as to prevent a flicker of a
position: 'absolute',
top: '0px',
width: '100%',
- 'z-index': '90'
+ 'z-index': '40999'
}
});
},
// stretch overlay to fill page and fade in
//var arrayPageSize = this.getPageSize();
- this.overlay.setHeight(Roo.lib.Dom.getDocumentHeight()) ;
- this.overlay.setWidth(Roo.lib.Dom.getDocumentWidth());
+ this.onResize();
+ if (!this.resizer) {
+ this.resizer = Roo.EventManager.onWindowResize(this.onResize, this, true);;
+ }
+
+
this.overlay.fadeIn({
endOpacity: this.overlayOpacity,
easing: 'easeOut',
});
//this.imageArray = [];
- var imageNum = 0;
+ var imageNum = -1;
if (imageLink) {
imageLink = Roo.get(imageLink);
imageNum = i;
}
});
+ if (imageNum < 0) {
+
+ this.imageArray.push(imageLink);
+ imageNum = this.imageArray.length-1;
+ }
}
-
+
// let's assume the constructor sorts out the list of images..
/*
if ((imageLink.rel == 'lightbox')){
var s = Roo.get(document).getScroll();
// calculate top and left offset for the lightbox
// weird.. why / 10?
- var lightboxTop = s.top + (Roo.lib.Dom.getViewHeight() / 10);
- var lightboxLeft = s.left
+
+ //var lightboxTop = s.top + (Roo.lib.Dom.getViewHeight() / 10);
+ var lightboxTop = (Roo.lib.Dom.getViewHeight() / 10) + document.body.scrollTop;
+ var lightboxLeft = s.left;
this.lightbox.setStyle({
top: lightboxTop + 'px',
left: lightboxLeft + 'px' ,
- zIndex : 1000
- })
+ zIndex : 41000
+ });
//console.log("show lightbox");
this.lightbox.show();
this.changeImage(imageNum);
},
+ onResize : function()
+ {
+ this.overlay.setHeight(Roo.lib.Dom.getDocumentHeight()) ;
+ this.overlay.setWidth(Roo.lib.Dom.getDocumentWidth());
+ },
//
// changeImage()
// Hide most elements and preload image in preparation for resizing image container.
// hide elements during transition
if (this.animate) {
this.loading.setStyle({
- zIndex :1200
+ zIndex : 41200
});
this.loading.show();
this.loadinglink.setX( (Roo.lib.Dom.getViewWidth() / 2) - 16);
imgPreloader.on('load', function() {
- this.lightboximage.dom.src = this.imageArray[this.activeImage].href ||
+ this.lightboximage.dom.src = this.imageArray[this.activeImage].srcfull || this.imageArray[this.activeImage].href ||
this.imageArray[this.activeImage].dom.href || this.imageArray[this.activeImage].dom.src;
- this.resizeImageContainer(imgPreloader.getWidth(), imgPreloader.getHeight());
+ this.resizeImageContainer(this.imageArray[this.activeImage].dom.lwidth || imgPreloader.getWidth(),
+ this.imageArray[this.activeImage].dom.lheight || imgPreloader.getHeight());
imgPreloader.remove();
}, this);
- imgPreloader.dom.src = this.imageArray[this.activeImage].href ||
+ Roo.log(this.imageArray[this.activeImage]);
+ imgPreloader.dom.src = this.imageArray[this.activeImage].srcfull || this.imageArray[this.activeImage].href ||
this.imageArray[this.activeImage].dom.href || this.imageArray[this.activeImage].dom.src;
},
ww -= 150;
wh -= 150;
+
// get new width and height
var bs = this.borderSize * 2;
'easeOut', // easing
'run' // effect
- )
+ );
// if new and old image are same size and no scaling transition is necessary,
var timeout = 0;
if ((hDiff == 0) && (wDiff == 0)){
timeout = 100;
- if (Roo.isIE) timeout = 250;
+ if (Roo.isIE) {
+ timeout = 250;
+ }
}
(function(){
// if image is part of set display 'Image x of x'
if (this.imageArray.length > 1){
this.numberdisplay.update(
- this.labelImage + ' ' + (this.activeImage + 1) + ' ' + this.labelOf + ' ' + this.imageArray.length)
+ this.labelImage + ' ' + (this.activeImage + 1) + ' ' + this.labelOf + ' ' + this.imageArray.length);
this.numberdisplay.show();
}
var _this = this;
this.hovernav.show();
// if not first image in set, display prev image button
- if (this.activeImage > 0) this.prevlink.show();
+ if (this.activeImage > 0) {
+ this.prevlink.show();
+ }
// if not last image in set, display next image button
- if (this.activeImage < (this.imageArray.length - 1)) this.nextlink.show();
+ if (this.activeImage < (this.imageArray.length - 1)) {
+ this.nextlink.show();
+ }
this.enableKeyboardNav();
},