X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fslideshow.js;h=5d648c8925f528cd5a0473766849671cf2fd9666;hp=0b19b6bd4b3df1a4560fe7ae049f859aeedb8dbf;hb=f8281d2d6eaaa20f2c65d9753a2870df1310fd1a;hpb=fc80339e3c4b8d62c2138734f8b778bd714aa46b diff --git a/include/slideshow.js b/include/slideshow.js index 0b19b6b..5d648c8 100644 --- a/include/slideshow.js +++ b/include/slideshow.js @@ -24,7 +24,8 @@ var slideShow = new Class({ thumbnailCls: 'outline', backgroundSlider: false, //change to be an instance. loadingCls: 'loading', - onClick: false + onClick: false, + comment: null, }; }, @@ -33,7 +34,7 @@ var slideShow = new Class({ this.container = $(container); this.container.setStyles({ - position: 'relative', + /* position: 'relative', */ overflow: 'hidden' }); if(this.options.onClick){ @@ -41,8 +42,8 @@ var slideShow = new Class({ this.options.onClick(this.imageLoaded); }.bind(this)); } - - + this.comm=this.options.comment; + this.imagesHolder = new Element('div').setStyles({ position: 'absolute', overflow: 'hidden', @@ -161,7 +162,8 @@ var slideShow = new Class({ this.imageObj = new Asset.image(img, {onload: this.show.bind(this)}); this.imageObj.set('width', width).set('height', height); } - + this.imageObj.set('id', this.images[this.image][i][3]); + this.imageObj.set('title', this.images[this.image][i][4]); }, restyle: function(imgobj){ @@ -173,8 +175,10 @@ var slideShow = new Class({ if (vfactor < factor) { factor = vfactor; } if (hfactor < factor) { factor = hfactor; } factor *= .95; - height = Math.round(height * factor); - width = Math.round(width * factor); + if (factor < 1) { + height = Math.round(height * factor); + width = Math.round(width * factor); + } var topoff = (this.height - height)/2; var leftoff = (this.width - width)/2; /* alert('dim: '+width+'x'+height+'+'+leftoff+'+'+topoff); */ @@ -215,6 +219,15 @@ var slideShow = new Class({ this.imageLoaded = this.image; this.loading.setStyle('display','none'); this.effect(); + this.comm = $(this.comm); + if (this.comm) { + var a = this.comm.getElement('a'); + if (a) a.dispose(); + a = new Element('a', { + href: '#'+this.imageObj.get('id'), + html: this.imageObj.get('title'), + }).injectInside(this.comm); + } }, wait: function(){ @@ -435,6 +448,9 @@ var slideShow = new Class({ resetAnimation: function(){ this.animating = false; + this.oldImage.setStyles({ + opacity: 0 + }); }, position: function(){