[英]Rubaxa sortable with polymer / Drag and Drop not working depending on display:
[英]RubaXa/Sortable cancel item drop using Polymer
我正在使用 Rubaxas sortable.js,这很棒。
现在我尝试取消下降,但它不起作用。
文档说:
onMove: function (/**Event*/evt) {
// Example: http://jsbin.com/tuyafe/1/edit?js,output
evt.dragged; // dragged HTMLElement
evt.draggedRect; // TextRectangle {left, top, right и bottom}
evt.related; // HTMLElement on which have guided
evt.relatedRect; // TextRectangle
// return false; — for cancel
}
所以我在这个例子中尝试了这个:
代码 :
<sortable-js id="sortable" animation="1000" filter=".noDrag" on-move="_elementMoving" on-end="_elementMoved" force-fallback="true", fallback-class="fallback">
<template is="dom-repeat" items="{{items.images}}">
<admin-image index$="{{index}}" type="{{type}}" image-set="{{_hasImage(item)}}" class$="admin_image {{_isDraggable(item, items, item.cover)}}" item="{{item}}"></admin-image>
</template>
</sortable-js>
_elementMoving() 函数:
_elementMoving : function(e){
return e.related.className.indexOf('noDrag') === -1;
}
},
那么我在这里做错了什么?
@RubaXa
帮助将不胜感激。
我这样解决了我的问题:
我没有使用filter
而是使用了draggable
。
代码 :
<sortable-js id="sortable" animation="1000" draggable=".drag" on-move="_elementMoving" on-end="_elementMoved" force-fallback="true", fallback-class="fallback">
<template is="dom-repeat" items="{{items.images}}">
<admin-image index$="{{index}}" type="{{type}}" image-set="{{_hasImage(item)}}" class$="admin_image {{_isDraggable(item, items, item.cover)}}" item="{{item}}"></admin-image>
</template>
</sortable-js>
_elementMoving
函数保持不变。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.