kissy
2024-10-20 11:34:53
<!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>
最新文章
- MyEclipse10查看Struts2源码及Javadoc文档
- 【转】mysql_fetch_row , mysql_fetch_array , mysql_fetch_assoc 的区别
- 输入三个整数,xyz,最终以从小到大的方式输出。利用中间变量
- hdu 1075 What Are You Talking About
- Running a Remote Desktop on a Windows Azure Linux VM (远程桌面到Windows Azure Linux )-摘自网络(试了,没成功 - -!)
- Linux下挂载新硬盘方法
- [05-01]Linux如何重启系统
- 红黑树与AVL特性
- java多线程(2)---生命周期、线程通讯
- CSharp工程中的几个文件
- Scrum Meeting 6
- HTTP 的长连接和短连接
- The Little Prince-12/11
- POJ 2965 The Pilots Brothers&#39; refrigerator (暴力枚举)
- 多个table 相同col 的 设置相同width
- QTQuick控件基础(2)
- “全栈2019”Java第五十七章:多态与构造方法详解
- Nearest Common Ancestors(LCA板子)
- pyquery库简介
- 【51NOD-0】1106 质数检测
热门文章
- 关于执行ST_Geometry的st_centroid函数时报ORA-28579错误的问题
- Arduino语言学习记录(持续更新)
- RedHat 6.5 离线安装 apache2.4.23
- uva 1203 - Argus
- Life Forms
- codeforces C. Little Pony and Expected Maximum
- R统计软件真有意思哈,以后我怕要用得着,先自学
- Initializing Spring root WebApplicationContext
- Android AlertDialog更改标题颜色,字体等
- 挖坑#3-----DP优化+CDQ分治+期望DP