draggable true不工作角度

时间:2015-09-22 06:56:58

标签: javascript angularjs

我有一个div:

  <div draggable = "true" ng-show="showPullDown" class="topPull stretch" draggable >

</div> 

draggable =true无效。我也试过通过控制器设置它,但没有帮助。任何替代或修复?

指令:

.directive('draggable', function ($ionicGesture) {
  return function(scope, element) {
        // this gives us the native JS object
       var startX = 0, startY = 0, x = 0, y = 0;
        element.draggable=true;
        var el = element[0];
        element.css({
       position: 'relative',
       cursor: 'pointer'
      });

$ionicGesture.on('dragstart',  function(e) { 
         e.dataTransfer.effectAllowed = 'move';

                return false;
            }, element);


$ionicGesture.on('dragend',  function(e) { 
                return false;
            }, element);
   }
})

我收到错误..

  

未捕获的TypeError:无法设置未定义的属性'effectAllowed'

console.log(e)给出了该事件,但console.log(e.dataTransfer)给出了undefined

0 个答案:

没有答案