r2546 - photoviewer: small refactoring, fixed demo css for overlay to better work in IE6, added m...

r2546 - photoviewer: small refactoring, fixed demo css for overlay to better work in IE6, added m...


Author: joern.zaefferer
Date: Wed May 13 03:23:20 2009
New Revision: 2546
Modified:
branches/photoviewer/demos/demos.css
branches/photoviewer/themes/base/ui.photoviewer.css
branches/photoviewer/ui/ui.photoviewer.js
Log:
photoviewer: small refactoring, fixed demo css for overlay to better work
in IE6, added ms-interpoliation for IE7
Modified: branches/photoviewer/demos/demos.css
==============================================================================
--- branches/photoviewer/demos/demos.css    (original)
+++ branches/photoviewer/demos/demos.css    Wed May 13 03:23:20 2009
@@ -1,3 +1,6 @@
+html, body {
+    height: 100%;
+}
body {
    font-size: 62.5%;
}
Modified: branches/photoviewer/themes/base/ui.photoviewer.css
==============================================================================
--- branches/photoviewer/themes/base/ui.photoviewer.css    (original)
+++ branches/photoviewer/themes/base/ui.photoviewer.css    Wed May 13 03:23:20
2009
@@ -1,3 +1,3 @@
/* Accordion
----------------------------------*/
-.ui-photoviewer { position: absolute; z-index: 1000; border: 20px solid
white; }
+.ui-photoviewer { position: absolute; z-index: 1000; border: 20px solid
white; /* for IE7 */ -ms-interpolation-mode: bicubic; }
Modified: branches/photoviewer/ui/ui.photoviewer.js
==============================================================================
--- branches/photoviewer/ui/ui.photoviewer.js    (original)
+++ branches/photoviewer/ui/ui.photoviewer.js    Wed May 13 03:23:20 2009
@@ -76,15 +76,7 @@
                $(this).attr("src", anchor.href).one("load", function() {
                    $(this).css("width", "").css("height", "");
                    if (self.options.resize) {
-                        var currentWidth = $(this).outerWidth(),
-                            currentHeight = $(this).outerHeight(),
-                            borderWidth = currentWidth - $(this).width(),
-                            borderHeight = currentHeight - $(this).height(),
-                            r = Math.min(Math.min($(window).width() - 36, currentWidth) /
currentWidth, Math.min($(window).height() - 60, currentHeight) /
currentHeight);
-                        $(this).css({
-                            width: Math.round(r * currentWidth - borderWidth),
-                            height: Math.round(r * currentHeight, - borderHeight)
-                        });
+                        self._resize($(this));
                    }
                    $(this).css({
                        left: $(window).width() / 2 - $(this).outerWidth() / 2,
@@ -108,6 +100,18 @@
                }, "normal", show);
            }
            
+        },
+        
+        _resize: function(img) {
+            var currentWidth = img.outerWidth(),
+                currentHeight = img.outerHeight(),
+                borderWidth = currentWidth - img.width(),
+                borderHeight = currentHeight - img.height(),
+                ratio = Math.min(Math.min($(window).width() - 36, currentWidth) /
currentWidth, Math.min($(window).height() - 60, currentHeight) /
currentHeight);
+            img.css({
+                width: Math.round(ratio * currentWidth - borderWidth),
+                height: Math.round(ratio * currentHeight, - borderHeight)
+            });
        },
        
        close: function() {