调用jquery的resize方法改变div的宽度和高度在IE中不变,在谷歌中可以正常显示

1、jquery代码:

  1.1问题的版本:

$(function() {
     haituheight();
     $(window).resize(function(){
              haituheight();
    });
});

//改变高度和宽度的方法
function haituheight() {
        var height = $(window).height()-$(‘.footer‘).height()-$(‘.header‘).height();
        var width = $(window).width()-$(".main-left").width();
        $("#FlexManyShips").css({"width":width,"height":height});

}

  1.2 解决之后的版本:

$(function() {
        var resize_window_height = $(window).height()-$(‘.footer‘).height()-$(‘.header‘).height();
        var resize_window_width = $(window).width()-$(".main-left").width()-1;
        haituheight(resize_window_height,resize_window_width);
        $(window).resize(function(){
             resize_window_height = $(window).height()-$(‘.footer‘).height()-$(‘.header‘).height();
             resize_window_width = $(window).width()-$(".main-left").width()-1;
             haituheight(resize_window_height,resize_window_width);
        });
});

//改变高度和宽度的方法
    function haituheight(haituhigh,width) {

        if (navigator.appName.indexOf("Microsoft") != -1) {
            var UA = navigator.userAgent;
            var is360se = UA.toLowerCase().indexOf(‘360se‘) > -1 ? true : false;//360浏览器
            if(!is360se) {
                document.getElementById("FlexManyShips_ie").style.height=haituhigh+ "px";
                document.getElementById("FlexManyShips_ie").style.width=width+ "px";
            } else {
                document.getElementById("FlexManyShips_ie").height = haituhigh+ "px";             
          document.getElementById("FlexManyShips_ie").width = width+ "px"; } } else {
        document.getElementById("FlexManyShips").style.height = haituhigh + "px";
        document.getElementById("FlexManyShips").style.width = width + "px"; } }

 

  1.3 html代码:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
    width="100%" height="100%" title="CJonline" id="FlexManyShips_ie"
    name="FlexManyShips_ie">
    <param name="src" value="flash/FlexManyShips.swf">
    <param name="wmode" value="opaque">
    <embed name="FlexManyShips" id="FlexManyShips" src="flash/FlexManyShips.swf"
        quality="high"
        pluginspage="http://www.macromedia.com/go/getflashplayer"
        type="application/x-shockwave-flash" width="100%" height="100%" >
    <param name="wmode" value="opaque">
    </embed> 
</object>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。