EasyUI 一般拖动

<html>
<head>
<title>draggable</title>
<script type="text/javascript" src="H:/jQuery EasyUI/jquery-easyui-1.5.3/jquery.min.js"></script>
<script type="text/javascript" src="H:/jQuery EasyUI/jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
<script>
$(function (){
$('#d').draggable({
/*revert boolean:如果设置为true,当拖动停止时元素将回到初始位置*/
revert:false
/*
cursor string:
Auto 自动、Crosshair “+”字、Default 默认、Hand 手型、Move 四向箭头、Text “I”行、Wait 等待、Help 帮助
*/
,cursor:'Help'
/*disabled boolean:如果设置为ture时停止拖动*/
,disabled:false
/*axis string:v 只能在垂直方向拖动、h 只能在水平方向拖动、不设置该属性时可在垂直水平方向自由拖动*/
,axis:'v'
/*
onBeforeDrag e:拖动之前触发
onStartDrag e:当目标对象开始被拖动时触发。 
onDrag e:在拖动过程中触发,当不能再拖动时返回false 
onStopDrag e:当拖动停止时触发 
*/
,onBeforeDrag:function(){
$('#title1').css('background','black').css('color','white');
$('#title2').css('background','red').css('color','white');
}
,onStopDrag:function(){
$('#title2').css('background','black').css('color','white');
$('#title1').css('background','red').css('color','white');
}
})
/*
options none:获取属性对象
enable none:运行拖动
disable none:静止拖动
*/
var propertiesJSON = $('#d').draggable('options');
var properties = "";
for(var item in propertiesJSON) {
properties = properties +item+"属性的值:"+propertiesJSON[item] + ";\n";
}
alert(properties);
})
</script>
</head>
<body>
<div id="d" style="width:500px;height:500px;">  
<div id="title1" style="background:black;color:white">一般拖动</div>  
<div id="title2" style="background:red;color:white">一般拖动</div>  
</div> 
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值