开发者

jQuery resize width on firefox

开发者 https://www.devze.com 2022-12-29 22:00 出处:网络
I\'m doing some experimen开发者_StackOverflow社区ts with jquery n widths for a liquid column and I\'m not sure why it isn\'t working on firefox.

I'm doing some experimen开发者_StackOverflow社区ts with jquery n widths for a liquid column and I'm not sure why it isn't working on firefox. It works fine on IE6,7,8 Chrome, Opera(sluggish). I found some articles about firefox not recognizing the .resize attribute but no explanation/solution =\

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


Update: Your problem is with your selector, simply change it to $('#midCol') to get the desired effect:

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

What version of Firefox are you using? I can't seem to reproduce resize() not working in Firefox (3.6.3). I suggest trying a simple demo page for the resize method and see if you're still having problems. If this example works, then your problem likely lies elsewhere and you'll need to include some more info.

<!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

精彩评论

暂无评论...
验证码 换一张
取 消