화면 너비를 감지하고 ID를 프레임의 DIV 너비로 설정하십시오. 웹 페이지의 최대 너비에 따라 조정하십시오. 작은 데모의 최대 너비는 1440입니다
코드 사본은 다음과 같습니다.
<! 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">
<헤드>
<meta http-equiv = "content-type"content = "text /html; charset = utf-8" />
<title> 제목의 문서 </title>
<script src = "js/jquery.min.js"type = "text/javaScript"> </script>
<cript>
함수 onwidthChange () {
var w = $ (창) .width ();
x = (W-1440)/2;
$ ( "#frame"). css ( "width", w);
if (w <1024) {
$ ( "#frame"). css ( "오버플로", "보이도");
$ ( "#webContent"). CSS ( "margin-left", x);
} else if (1024 <w <1440) {
$ ( "#frame"). css ( "오버플로", "숨겨진");
$ ( "#webContent"). CSS ( "margin-left", x);
}
settimeout (onwidthchange, 0);
};
</스크립트>
</head>
<body>
<div id = "frame"style = "오버플로 : 숨겨진;">
<div id = "WebContent">
//콘텐츠
</div>
</div>
</body>
</html>