<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="../css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<script language="javascript" type="text/javascript" src="../js/jquery-1.7.1.min.js">
</script>
<script language="javascript" type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js">
</script>
<script language="javascript" type="text/javascript">
$(document).ready(function (){
$("#draggable").draggable({
//axis:"x",//只能x轴拖动
//revert:true,//回到原始位置
//revert:"invalid",
//helper:"clone",//克隆
// cursor:"move",
// cursor:"crosshair",//鼠标点击move后鼠标的效果为crosshair
cursorAt:{top:100,left:100},
start:function(event,ui){
},
zIndex:10,
opacity:0.2,
grid:[20,60],
containment:"#tx",
});
});
</script>
</head>
<body>
<div id="draggable" style="width:100px;height:100px;border:#F93 solid 1px;">
<p>aaaaaaaaaaaa</p>
</div>
<div id="tx" style="border:#F99 solid 2px;width:400px;height:300px;">
</div>
</body>
</html>
效果图如下