2010-12-17 8 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 
を渡すことができ、この

を試してみました

関連する問題