2010-12-17 6 views
0

div가 스크롤 된 다음 크기가 조정될 때까지 드래그하면 실제 위치가 표시되지 않고 뷰포트를 기준으로 위치가 변경됩니다. 실제 위치를 유지하는 방법은 무엇입니까?jQuery : 뷰포트에 상대적으로 위치 변경

<!DOCTYPE HTML> 
<html> 
<head> 
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css"/> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js" type="text/javascript"></script> 
<script> 
(function($){$(document).ready(function(){ 
    $('#theDiv').draggable().resizable(); 
})})(jQuery); 
</script> 
</head> 
<body> 
    <div id="container" style="position:relative;width:600px;height:600px;border:solid 1px #000;overflow:auto;"> 
     <div id="theDiv" style="width:200px;height:200px;border:solid 1px #000;"></div> 
    </div> 
</body> 
</html> 

답변

0

는이

당신이 위치를 계산하고 scrolltop

$("#divid").scrollTop(300); // 300 is just a sample 
에 전달할 수있는 시도 했