我想要灵活的宽度,我的意思是当我尝试调整窗口大小时,我的窗口宽度会自动更改(基于窗口宽度)而不刷新
我想在我的示例文档中这样做,我该怎么做?
我的示例文件:
<!DOCTYPE html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(document).ready(function() {
var Ww = $(window).width()
var Wh = $(window).height()
$('.test').css({"width":Ww+"px","height":Wh+"px"});
});
</script>
<style>
* {
margin:0;
padding:0;
}
.test {
background-color:#000;
}
</style>
</head>
<div class="test"></div>
<body>
</body>
</html>