From cb05788dc6a9bca81f5536143a7be3d1f6d36236 Mon Sep 17 00:00:00 2001 From: arno Date: Sun, 16 Aug 2009 23:54:45 +0200 Subject: [PATCH] compute position for close button once full screen image has been correctly sized --- js/syp.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/syp.js b/js/syp.js index c361387..6c59dcd 100644 --- 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; }, -- 2.39.2