]> dev.renevier.net Git - syp.git/commitdiff
compute position for close button once full screen image has been correctly sized
authorarno <arenevier@fdn.fr>
Sun, 16 Aug 2009 21:54:45 +0000 (23:54 +0200)
committerarno <arenevier@fdn.fr>
Thu, 20 Aug 2009 08:36:39 +0000 (10:36 +0200)
js/syp.js

index c3613873523bb999d0e220a896c81de7d7127475..6c59dcdd3bbe55d5a7866530ae73eb0c879a3b33 100644 (file)
--- a/js/syp.js
+++ b/js/syp.js
@@ -253,10 +253,6 @@ var SYP = {
         document.getElementById('bigimg').style.maxHeight = maxHeight + "px";
         document.getElementById('bigimg').style.maxWidth = maxWidth + "px";
         document.getElementById('bigimg').onload = function () {
-            var icon = document.getElementById('bigimg_close');
-            icon.style.top = this.offsetTop;
-            icon.style.left = this.offsetLeft + this.clientWidth - icon.clientWidth;
-
             var heightRatio = this.clientHeight / parseInt(this.style.maxHeight);
             var widthRatio = this.clientWidth / parseInt(this.style.maxWidth);
             if (heightRatio > 1 || widthRatio > 1) {
@@ -267,6 +263,10 @@ var SYP = {
                 }
             }
 
+            var icon = document.getElementById('bigimg_close');
+            icon.style.top = this.offsetTop;
+            icon.style.left = this.offsetLeft + this.clientWidth - icon.clientWidth;
+
         };
         document.getElementById('bigimg').src = href;
     },