Avoid javascript errors
authorJoachim Breitner <mail@joachim-breitner.de>
Thu, 27 May 2010 08:08:00 +0000 (08:08 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Thu, 27 May 2010 08:08:00 +0000 (08:08 +0000)
sm.html

diff --git a/sm.html b/sm.html
index 1868e98..5640850 100644 (file)
--- a/sm.html
+++ b/sm.html
@@ -61,8 +61,8 @@ function adjust() {
        ta.style.paddingBottom = Math.floor((window.innerHeight - newHeight)/2) + "px";
        newWidth = Math.ceil(test.offsetWidth * ratio);
        //ta.style.width = newWidth + "px";
-       ta.style.paddingLeft = Math.floor((window.innerWidth - newWidth)/2) + "px";
-       ta.style.paddingRight = Math.floor((window.innerWidth - newWidth)/2) + "px";
+       ta.style.paddingLeft = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
+       ta.style.paddingRight = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
         
        //test.innerHTML = newHeight + " " + window.innerHeight + " " + fontSize;
 }