调用jquery的resize方法改变div的宽度和高度在IE中不变,在谷歌中可以正常显示
2024-10-20 00:24:09
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>
最新文章
- ";org.jboss.netty.internal.LoggerConfigurator";.DESCRIBED is already registered 的解决办法
- Eclipse-导入maven项目
- Parallel.ForEach() 并行循环
- 互联网挣钱info
- c# linq 基础知识点
- 在IAR下移植CC2650 contiki工程
- python全栈开发day118-Mui
- 性能测试 基于Python结合InfluxDB及Grafana图表实时采集Linux多主机性能数据
- javafx安装
- Installation failed with message Failed to finalize session: INSTALL_FAILED_TEST_ONLY:installPackageLI.
- oracle查询视图归属于哪个用户
- DevExpress控件使用方法:第二篇 barManager
- Java系列: 如何在Eclipse中安装Memory Analyzer插件
- 服务不支持chkconfig的解决
- stringBuild置空方法
- PHP生成GIF动态图片验证码
- TFS 切换登录用户的方法[转]
- [NC13A]反蝴蝶效应/[SPOJ-NPC2014D]General Joke
- npm安装及webpack打包小demo
- 搭建git服务器(临时服务器,命令行形式,针对2到5人左右,轻量)