3 Star 22 Fork 5

张鑫旭/极简JS拖拽

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
demo.html 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
张鑫旭 提交于 2021-12-03 20:45 . first blood
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>zxxDrag 拖拽演示页面</title>
<style>
.box{position:absolute; left:10px; top:50px; padding:5px; background:#f0f3f9; font-size:14px; box-shadow:2px 2px 4px #666666;}
.main{border:1px solid #a0b3d6; background:white;}
.bar{line-height:2; background:#beceeb; border-bottom:1px solid #a0b3d6; padding: 0 10px; cursor:move;}
.content{width:420px; height:250px; padding:10px; max-width: calc(100vw - 60px); background-color: #fff;}
.heading{margin-top:90vh;}
.container{outline:1px solid; max-width: 414px; height: 300px; background-color: #f5f5f5; position: relative;}
.target{width: 100px; height: 100px; background-color: #a0b3d6; opacity: .9; position: absolute;}
.target:active{opacity: 1;}
</style>
</head>
<body>
<div id="box" class="box">
<div class="main">
<div id="bar" class="bar">拖拽</div>
<div class="content">
内容……
</div>
</div>
</div>
<h3 class="heading">内部拖拽</h3>
<div id="container" class="container">
<div id="target" class="target"></div>
</div>
<script src="./zxxDrag.js"></script>
<script>
zxxDrag(bar, {
target: box
});
zxxDrag(target, {
bounding: container
});
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/zhangxinxu/zxx-drag.git
git@gitee.com:zhangxinxu/zxx-drag.git
zhangxinxu
zxx-drag
极简JS拖拽
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385