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