div拉拽

2019-08-21  本文已影响0人  叫我亮王

*{
margin: 0;
padding: 0;
}
.cl {
width: 100%;
margin: 0 auto;
font-family: arial, SimSun;
font-size: 0;
}

        .cl .item {
            display: inline-block;
            width: 33%;
            margin: 0 0.33% 0 0;
            background-color: #ccc;
        }
        
        .cl .item1 {
            background-color: #1faeff;
        }
        
        .cl .item2 {
            background-color: #ff2e12;
        }
        
        .cl .item3 {
            background-color: #00c13f;
        }
        
        .cl .h4 {
            margin: 0;
            padding: 0.5rem;
            border-bottom: 1px solid #ccc;
            font-size: 0.75rem;
            color: #fff;
        }
        
        .cl span {
            display: block;
            line-height: 100px;
            font-size: 2rem;
            text-align: center;
            color: #fff;
        }

.dad-noSelect,.dad-noSelect *{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: -webkit-grabbing !important;
cursor: -moz-grabbing !important;
}

.dad-container{
position: relative;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dad-container::after{
content: '';
clear: both !important;
display: block;
}
.dad-active .dad-draggable-area{
cursor: -webkit-grab;
cursor: -moz-grab;
}
.dads-children-clone{
opacity: 0.8;
z-index: 9999;
pointer-events: none;
}
.dads-children-placeholder{
overflow: hidden;
position: absolute !important;
box-sizing: border-box;
border:4px dashed #639BF6;
margin:5px;
text-align: center;
color: #639BF6;
font-weight: bold;
}

/*!

调用
<script>
(function() {('.cl').dad({
draggable: '.h4'
});
});
</script>

html
<div class="cl">

        <div class="item item1">
            <h4 class ="h4">标题</h4>
            <span>1</span>
        </div>
        
        <div class="item item2">
            <h4 class="h4">标题</h4>
            <span>2</span>
        </div>
        
        <div class="item item3">
            <h4 class="h4">标题</h4>
            <span>3</span>
        </div>
        

    </div>
上一篇 下一篇

猜你喜欢

热点阅读