首页 > Web开发 > 详细

jQuery插件jquery ui实现拖放

时间:2015-03-26 14:51:35      阅读:343      评论:0      收藏:0      [点我收藏+]

cusor为move表示光标为move类型,cursorAt指示光标所在的位置。当删除了拖拽功能后,必须要再次调用draggable()才能继续使用拖拽

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../public/js/jquery-1.8.3.js"></script>
<script src="../public/js/jquery-ui-1.10.4.custom.js"></script>
<script src="../public/js/jquery-ui.js"></script>
<title>拖放功能</title>
<style type="text/css">
#draggable{width: 150px;height: 150px;background-color: #990}
</style>
<script type="text/javascript">
$(document).ready(function(){
    //使用draggable初始化拖放功能
    $("#draggable").draggable({cusor:"move",cursorAt:{top:56,left:56}});
    $("#btnenable").click(function(e){
        $("#draggable").draggable("enable");
    });
    $("#btndisable").click(function(e){
        $("#draggable").draggable("disable");
    });
    $("#btndestroy").click(function(e){
        $("#draggable").draggable("destroy");
    });
});
</script>
</head>
<body>
    <button id="btnenable">允许拖放</button>
    <button id="btndisable">禁止拖放</button>
    <button id="btndestroy">删除拖放功能</button>
    <div id="draggable" class="ui-widget-content">
        <p>click here to drag</p>
    </div>
</body>
</html>

jQuery插件jquery ui实现拖放

原文:http://blog.csdn.net/colorsunlight/article/details/44649375

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!