【发布时间】:2014-02-22 06:13:21
【问题描述】:
我的网页中有几个类,我希望用户将其拖放到页面中他们想要的任何位置。
HTML 代码
<html>
<head>
<style>
#drag{ width: 100px; height: 100px; padding: 0.5em; background:red; margin-bottom:10px;}
#drag1{ width: 100px; height: 100px; padding: 0.5em; background:blue; margin-bottom:10px;}
#drag2{ width: 100px; height: 100px; padding: 0.5em; background:green; margin-bottom:10px;}
#drag3{ width: 100px; height: 100px; padding: 0.5em; background:yellow; margin-bottom:10px;}
</style>
</head>
<body>
<div id="drag">
<p>Drag me around</p>
</div>
<div id="drag1">
<p>Drag me around</p>
</div>
<div id="drag2">
<p>Drag me around</p>
</div>
<div id="drag3">
<p>Drag me around</p>
</div>
</body>
</html>
我想要最简单的 jquery 代码来实现这个功能。请帮忙
【问题讨论】:
标签: javascript jquery html