ソースを参照

Fix alignment bug with NaN values

Jay Salvat 14 年 前
コミット
8bb6e1bdb2
1 ファイル変更7 行追加3 行削除
  1. 7 3
      jquery.vegas.js

+ 7 - 3
jquery.vegas.js

@@ -337,10 +337,14 @@
 
 
         properties = {
         properties = {
             'width': newWidth + 'px',
             'width': newWidth + 'px',
-            'height': newHeight + 'px'
+            'height': newHeight + 'px',
+			'top': 'auto',
+			'bottom': 'auto',
+			'left': 'auto',
+			'right': 'auto'			
         }
         }
 
 
-        if ( parseInt( options.valign ) != 'NaN' ) {
+        if ( !isNaN( parseInt( options.valign ) ) ) {
             properties[ 'top' ] = ( 0 - ( newHeight - wh ) / 100 * parseInt( options.valign ) ) + 'px';
             properties[ 'top' ] = ( 0 - ( newHeight - wh ) / 100 * parseInt( options.valign ) ) + 'px';
         } else if ( options.valign == 'top' ) {
         } else if ( options.valign == 'top' ) {
             properties[ 'top' ] = 0;
             properties[ 'top' ] = 0;
@@ -350,7 +354,7 @@
             properties[ 'top' ] = ( wh - newHeight ) / 2;
             properties[ 'top' ] = ( wh - newHeight ) / 2;
         } 
         } 
 
 
-        if ( parseInt( options.align ) != 'NaN' ) {
+        if ( !isNaN( parseInt( options.align ) ) ) {
             properties[ 'left' ] = ( 0 - ( newWidth - ww ) / 100 * parseInt( options.align ) ) + 'px';
             properties[ 'left' ] = ( 0 - ( newWidth - ww ) / 100 * parseInt( options.align ) ) + 'px';
         } else if ( options.align == 'left' ) {
         } else if ( options.align == 'left' ) {
             properties[ 'left' ] = 0;
             properties[ 'left' ] = 0;