我使用angular-js dragula进行拖放
我需要保存位置,因为用户选择自定义div位置。 这就是我的html外观
<div class='wrapper'>
<div class='container' 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>
使用$scope.$on
我会收到over
和out
事件,但我无法获得id
或类似的获取位置,以存储在Cookie中。< / p>
$scope.$on('first-bag.over', function (e, el) {
el.addClass('over');
console.log(e);
console.log(el);
})
$scope.$on('first-bag.out', function (e, el) {
el.removeClass('over');
console.log(e);
console.log(el);
});
这是plunker,打开控制台,看看会发生什么。 请等一下,如果有人知道如何在每次拖放时保存div命令,那么下次当用户回来获取保存位置时。日Thnx