Html
    Css
    Js

    
                        
.parent-box {
	width:400px;
	float:left;
	margin:40px;
	-moz-user-select:none;
	-ms-user-select:none;
	-webkit-user-select:none;
}
.list {
	width:100%;
	padding:10px;
	margin:0;
	position:relative;
	padding-bottom:0;
	border:1px solid #999;
}
.list li {
	display:block;
	width:400px;
	height:50px;
	border:1px solid #999;
	margin-bottom:10px;
	background:#ccc;
	box-sizing:border-box;
}
li.edit-able {
	cursor:move;
	border-style:dashed;
	border-color:#eee;
	transition:all .3s ease;
}
.list li.move-item {
	box-shadow:4px 4px 4px #AAAAAA;
	opacity:0.5;
}
button {
	padding:0 10px;
	height:30px;
	margin-bottom:30px;
	margin-right:10px;
	border:none;
	background:#aaa;
	cursor:pointer;
	outline:none;
}
button.on {
	background:#eee;
}
.dashed-box {
	position:absolute;
	background:#fff9c4;
	border:1px dashed #ff9800;
	box-sizing:border-box;
	z-index:-1;
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

原生js面向对象拖拽排序

0