<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>拖放</title>
<style type="text/css">
.test1 {
position: absolute;
left:100px;
top:100px;
width:100px;height:20px;
background:grey;
}
.test2 {
position: absolute;
left:100px;
top:200px;
width:100px;height:20px;
background:red;
}
.test3 {
position: absolute;
left:200px;
top:300px;
width:200px;height:40px;
background:yellow;
}
</style>
</head>
<body>
<script src="http://a.tbcdn.cn/s/kissy/1.3.0rc/seed-min.js"></script>
<div id="t1">
选择你要拖拽的按钮:
<ul>
<li><button class="test1" id="click-me">A</button></li>
<li><button class="test2" id="click-me2">B</button></li>
</ul>
</div> <script type="text/javascript">
KISSY.use('node',function(S,Node){
Node.one('.test1').on('click',function(e){ KISSY.DOM.style('.test1', {position: 'absolute', top: '300px', left: '300px', width:'200px', height:'40px'});
Node.one('.test1').html('Hello Kissy!'); }); Node.one('.test2').on('click',function(e){
KISSY.DOM.style('.test1', {position: 'absolute', top: '100px', left: '100px', width:'100px', height:'20px'});
Node.one('.test2').html('Hello Kissy!');
});
});
KISSY.use("dd",function(S,DD){ var drag=new DD.Draggable({
node:'.test1',
cursor:'move',
move:true
});
var drag2=new DD.Draggable({
node:'.test2',
cursor:'move',
move:true
});
//使当前拖放对象具备代理功能.
new DD.Proxy().attach(drag);
new DD.Proxy().attach(drag2);
var c = new DD.Constrain({
constrain: true
});
//限制拖放元素的范围为可视窗口区域
c.attachDrag(drag);
c.attachDrag(drag2);
});
</script>
</body>
</html>

  

最新文章

  1. MyEclipse10查看Struts2源码及Javadoc文档
  2. 【转】mysql_fetch_row , mysql_fetch_array , mysql_fetch_assoc 的区别
  3. 输入三个整数,xyz,最终以从小到大的方式输出。利用中间变量
  4. hdu 1075 What Are You Talking About
  5. Running a Remote Desktop on a Windows Azure Linux VM (远程桌面到Windows Azure Linux )-摘自网络(试了,没成功 - -!)
  6. Linux下挂载新硬盘方法
  7. [05-01]Linux如何重启系统
  8. 红黑树与AVL特性
  9. java多线程(2)---生命周期、线程通讯
  10. CSharp工程中的几个文件
  11. Scrum Meeting 6
  12. HTTP 的长连接和短连接
  13. The Little Prince-12/11
  14. POJ 2965 The Pilots Brothers&#39; refrigerator (暴力枚举)
  15. 多个table 相同col 的 设置相同width
  16. QTQuick控件基础(2)
  17. “全栈2019”Java第五十七章:多态与构造方法详解
  18. Nearest Common Ancestors(LCA板子)
  19. pyquery库简介
  20. 【51NOD-0】1106 质数检测

热门文章

  1. 关于执行ST_Geometry的st_centroid函数时报ORA-28579错误的问题
  2. Arduino语言学习记录(持续更新)
  3. RedHat 6.5 离线安装 apache2.4.23
  4. uva 1203 - Argus
  5. Life Forms
  6. codeforces C. Little Pony and Expected Maximum
  7. R统计软件真有意思哈,以后我怕要用得着,先自学
  8. Initializing Spring root WebApplicationContext
  9. Android AlertDialog更改标题颜色,字体等
  10. 挖坑#3-----DP优化+CDQ分治+期望DP