如何删除 div 的可拖动事件?
我想将新的 .point 添加到容器,然后对其进行拖动,但首先我想取消绑定 $('.piont') 的所有可拖动事件,该怎么做?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.2/jquery-ui.js"></script>
<style type="text/css">
*{margin:0;padding:0}
.container{
margin:50px;
width:100px;
height:100px;
border:1px solid #777;
position:relative
}
.point{
width:20px;
height:20px;
background-color:tan;
position:absolute;
}
</style>
<script type="text/javascript">
$(function(){
$('.point').draggable({
stop: function (e){
alert(1);
}
});
});
function unbind_draggable(){
// how can unbind draggable for .point?
}
</script>
<div class="container">
<div class="point"></div>
<div class="point"></div>
<div class="point"></div>
<div class="point"></div>
</div>
<button onclick="unbind_draggable()">unbind_draggable</button>