87,907
社区成员
发帖
与我相关
我的任务
分享
$("#test").draggable({
containment:"parent"
});
$("#test").resizable({
containment:"parent"
});
<html>
<script src="jquery-1.8.0.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="jquery-ui-1.10.0.custom.css">
<script src="jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("#test").draggable({
containment:"parent"
});
$("#test").resizable({
containment:"parent"
});
});
</script>
<body>
<div id="container" style="width:200px;height:500px;border:1px solid red;margin-left:100px">
<div id="test" style="width:50px;height:100px;background-color:red;">
</div>
</div>
</body>
</html>