获得拖放位置

时间:2017-11-17 09:32:18

标签: javascript css angularjs angular-dragula

我使用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我会收到overout事件,但我无法获得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

https://plnkr.co/edit/AeGw9A3196DsYBHFv98b?p=preview

0 个答案:

没有答案