2010-05-12 112 views
1

我正在做一些針對液柱的jquery n寬度的實驗,我不確定它爲什麼不能在firefox上工作。 它在IE6,7,8 Chrome,Opera(slowggish)上正常工作。 我發現關於Firefox無法識別.resize屬性,但沒有解釋/液= \jQuery調整firefox的寬度

$(document).ready(function(){ 
$(midCol).width((window,$(window).width()) - 470) 
$(window).resize(function(){$(midCol).width((window,$(window).width()) - 470) 
}) 
}); 

回答

1

更新一些文章:你的問題是你的選擇,只需將其更改爲$('#midCol'),以獲得所需的效果:

$(document).ready(function(){ 
    $('#midCol').width($(window).width() - 470) 
    $(window).resize(function() { 
     $('#midCol').width($(window).width() - 470) 
    }) 
}); 

您使用的是哪個版本的Firefox?我似乎無法複製在Firefox(3.6.3)中不起作用的resize()。我建議爲resize方法嘗試一個簡單的演示頁面,看看你是否仍然有問題。如果這個例子有效,那麼你的問題可能在別處,你需要包含更多的信息。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      $(window).resize(function() { 
       $('#log').append('<div>Handler for .resize() called.</div>'); 
      }); 
     }); 
    </script> 
</head> 
<body> 
    <div id="log"></div> 
</body> 
</html> 
+0

呵呵,我以爲我有最後一個firefox。礦是3.5.9。我會立即下載新的。 = \ 我有一個測試頁面在我的保管箱上運行。 http://dl.dropbox.com/u/3359906/cballenar.wordpress/hybridlayout.jquery/index.html – LM35DT 2010-05-13 02:20:55

+0

補...我沒有看到。 謝謝! – LM35DT 2010-05-13 02:34:47