.draft {
width:600px;
height:600px;
background-color:#109d71;
margin:50px auto;
position:relative;
}
.draft span {
width:200px;
height:200px;
border:1px solid #000;
position:absolute;
left:0;
top:0;
cursor:move;
background:#c3003c;
}
使用原生js实现的有边界限制的拖拽,用户可以在有效区域内随意拖动哦(本demo没有使用面向对象实现,后续会继续更新)!