<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<style>
*{
padding: 0;
margin: 0;
}
#box{
background-color: red;
height: 100px;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<div id="box"></div>
<script type="text/javascript">
$(window).resize(function () {
var box = $("#box");
box.css({"width": ""+ $(document).width() +"px"});
})
</script>
</body>
</html>屏幕由小变大div的宽度随之变大,为什么由大到小div宽度不变?怎么让div由大到小时随页面大小变小?
添加回答
举报
0/150
提交
取消