前端拖拽原型

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zxmin1302/article/details/80840696
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#div1{float:left; width:198px; height:66px; margin:10px;padding:10px;border:1px solid #aaaaaa;}
.one{
width: 100%;
    height: auto;
    border: 1px solid #eee;
}
.title{
width: 90%;
    margin: auto;
    margin-top: 10px;
    padding-left: 20px;
    background: #673AB7;
    height: 30px;
    line-height: 30px;
    color: #fff;
    font-size: 12px;
    border-radius: 4px 4px 0 0;
    font-family: unset;
}
.infos{
width: 95%;
    height: auto;
    line-height: 36px;
    margin: auto;
    margin-bottom: 15px;
    background: #f5e7e7;
    border-radius: 0 0 4px 4px;
    font-size: 12px;
}
.delete_affiche{
width: 35px;
    height: 25px;
    line-height: 26px;
    border: 1px solid #c5c3c3;
    background: #64bd68;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 20px;
    margin-bottom: 15px;
}
}
</style>
<script type="text/javascript">
function allowDrop(ev)
{
ev.preventDefault();
}


function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}


function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
</script>
</head>
<body>


<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)" style="height: auto;min-height: 400px;width: 400px;">
  <div draggable="true" ondragstart="drag(event)" id="drag1" />
<div class="col-md-3 col-sm-6 col-xl-12 one">
<div class="affiche_info">
<div class="title">
时光禁止<span style="float: right; margin-right: 20px;">2019-5-12</span>
</div> 
<div class="infos" >时光静好,与君语;细水流年,与君同。—— Amaze UI</div> 
<div class="delete_affiche">
<span class="fa">编辑</span>
</div>
</div>
</div>
</div>
</div>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)" style="height: auto;min-height: 400px;width: 400px;"></div>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)" style="height: auto;min-height: 400px;width: 400px;"></div>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)" style="height: auto;min-height: 400px;width: 400px;"></div>
</body>

</html>



没有更多推荐了,返回首页