原生js实现拖拽排序可添加列表效果代码
代码语言:html
所属分类:拖放
代码描述:原生js实现拖拽排序可添加列表效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<style>
@import url("https://fonts.googleapis.com/css?family=Raleway:300,800");
body {
background-color: #0072ff;
}
body h1 {
text-align: center;
font-family: "Raleway", sans-serif;
color: white;
font-size: 50px;
font-weight: normal;
}
body .adder {
position: relative;
width: 250px;
margin: 0px auto;
display: block;
}
body .adder ::-webkit-input-placeholder {
color: #cecece;
}
body .adder .input {
outline: none;
border: 1px solid white;
background-color: #0072ff;
color: white;
height: 50px;
width: 250px;
padding-left: 10px;
font-family: "Raleway", sans-serif;
font-weight: 800;
font-size: 16px;
margin-left: -5px;
}
body .adder span {
position: absolute;
right: 0;
top: 0;
font-size: 30px;
font-weight: 800;
line-height: 1.8;
cursor: pointer;
transition: all 200ms;
color: white;
will-change: transform;
}
body .adder span:hover {
transform: rotate(180deg);
}
body ul {
padding: 0px;
}
body ul .draggable {
will-change: transform;
font-family: "Raleway", sans-serif;
font-weight: 800;
height: 50px;
list-style-type: none;
margin: 10px;
background-color: white;
color: #0072ff;
width: 250px;
line-height: 3.2;
padding-left: 10px;
cursor: move;
transition: all 200ms;
user-select: none;
margin: 10px auto;
position: relative;
}
body ul .draggable:after {
content: "drag me.........完整代码请登录后点击上方下载按钮下载查看
网友评论0