경계선과 함께 절대 위치 지정을 위해 2 div를 정의한 샘플 HTML5 파일을 둘러싸고 있습니다. 둘 다 작동하지 않습니다. 좀 도와 줄 수있어? 나는 오랫동안 여기에 붙어 있고 여러 순열, 내가 웹에서 본 것들의 조합을 시도했습니다. CSS 등에서 사용하기 위해이 파일에 정의 된 변수를 사용해야합니다.jQuery 절대 위치 지정 및 경계 문제
미리 도움을 주셔서 감사합니다. 동봉 된 파일을 변경 한 후 전체 파일을 게시 할 수 있다면 정말 감사하겠습니다. 감사합니다,
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Absolute Positioning Test</title>
<style type="text/css">
html, body {
position:absolute;
top:0;
right:0;
margin:0px;
padding:0px 0px 0px 0px;
height:100%;
width:100%;
}
div {
position:absolute;
margin:0px;
padding:0px 0px 0px 0px;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/JavaScript">
var A_height = 100;
var A_width = 100;
var A_top = 20;
var A_left = 20;
var B_height = 200;
var B_width = 200;
var B_top = 200;
var B_left = 200;
jQuery("#A").css({ "width": A_width, "height": A_height, "border":'1px solid black'});
jQuery("#B").css({ "width":B_width, "height":B_height, "border":'1px solid black'});
jQuery("#A").offset({top: A_top, left: A_left});
jQuery("#B").offset({top: B_top, left: B_left});
</script>
</head>
<body>
<div id="A">
<p>HELLO A</p>
</div>
<div id="B">
<BR></BR>
<p>HELLO B</p>
</div>
</body>
</html>
작동하지 않는 기능은 무엇입니까? – mrtsherman
조금만 읽으면 다치게되지 않을 것입니다. 나는 $ (document) .ready()가 모든 jQuery 튜토리얼의 시작 부분에서 언급되었다고 확신한다. – ZolaKt