嘿,我正在使用DragulaJS-Angular版本来获得两个桶之间拖放的效果。我对这个库有几个问题。第一个,我可以移动只属于同一个桶的项目,如果我定义了不同的桶,那么我不能在它们之间移动项目。
解释我的代码和我的目标:
我有 3 个 div,容器一、容器二和容器三。
我的主要目标是:
1.仅将物品从容器一和容器二传递到容器三。
2.一号货柜和二号货柜之间不得转运物品。
3.另外我想为从容器一转移的每个项目添加类|| 容器二到容器三。
- 此外,我希望能够清洁袋子并重置系统。
5.我想制作一个将元素从一个包传递到另一个包的动画,当前的动画是不够的。我还需要查看两个容器之间的拖动元素,而不仅仅是其中一个容器。我的代码:
var app = angular.module("app",[angularDragula(angular)]);
app.controller('MainCtrl', function($scope, dragulaService) {
dragulaService.options($scope, 'first-bag', {
copy: true
});
});
.container {
float: left;
width: 48%;
margin-right: 2%;
padding: 10px;
min-height: 300px;
background-color: rgba(0, 0, 0, 0.2);
transition: opacity 0.4s ease-in-out;
cursor: move;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
box-sizing: border-box;
}
.container div {
padding: 10px 15px;
margin: 10px 0;
background-color: rgba(0, 0, 0, 0.2);
}
.gu-transit {
opacity: 0.2;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
filter: alpha(opacity=20);
}
<script src="https://rawgit.com/bevacqua/angular-dragula/master/dist/angular-dragula.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="MainCtrl">
<div class='wrapper'>
<div class='container' id="container-one" dragula='"first-bag"'>
<div>You can move these elements between these two containers</div>
<div>Moving them anywhere else isn't quite possible</div>
<div>There's also the possibility of moving elements around in the same container, changing their position</div>
</div>
<div class='container' id="container-two" dragula='"first-bag"'>
<div>You can move these elements between these two containers</div>
<div>Moving them anywhere else isn't quite possible</div>
<div>There's also the possibility of moving elements around in the same container, changing their position</div>
</div>
<div class='container' id="container-third" dragula='"first-bag"'>
<div>This is the default use case. You only need to specify the containers you want to use</div>
<div>More interactive use cases lie ahead</div>
<div>Make sure to check out the <a href='https://github.com/bevacqua/dragula#readme'>documentation on GitHub!</a></div>
</div>
</div>
</div>