我刚刚试图在奥法里(一篮子为14.0.1)找到土生土长的花rag;我正在更新这一答案,因为我的头目结果(似乎还没有其他的q&a)现在。
Following https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/SafariJSProgTopics/DragAndDrop.html
I have found native html5 drag&drop now works in safari, with a few specific notes;
(效果环境似乎是任择性的)
页: 1 否则,聋 the人将装上你补充的数据(除非你打算这样做)
OnDragOver
event handler needs Event.preventDefault();
otherwise drop fails (unless intended, as docuemnted)
如果你制定<代码> OnDragStart s Event.data Transfer.dropEffect=拷贝/code>和。 OnDragOver
s Event.datatransfer.dropEffect=link
the abolition. . . 跌倒闭(无OnDrop(<>
>); 种子是唯一失败的组合
我认为,你需要你帮助。
- CSS
-webkit-user-drag: Element;
and `-webkit-user-drop: element;
or if you prefer
Element.style.setProperty( webkitUserDrag , element );
Element.style.setProperty( webkitUserDrop , element );
but it seems just the usual draggable
attribute is enough
Element.setAttribute( draggable ,true);
看来,这似乎只是微乎其微的拖拉和安放,而放弃了部分。
Element.setAttribute( draggable ,true);
function OnDragOver(Event)
{
Element.setAttribute( DragOver ,true);
Event.stopPropagation(); // let child accept and don t pass up to parent element
Event.preventDefault(); // ios to accept drop
Event.dataTransfer.dropEffect = copy ;// move has no icon? adding copy shows +
}
function OnDragLeave(Event)
{
Element.removeAttribute( DragOver );
}
function OnDrop(Event)
{
Element.removeAttribute( DragOver );
Event.preventDefault(); // dont let page attempt to load our data
Event.stopPropagation();
}
function OnDragStart(Event)
{
Event.stopPropagation(); // let child take the drag
Event.dataTransfer.dropEffect = move ;
Event.dataTransfer.setData( text/plain , hello );
}
Element.addEventListener( dragstart ,OnDragStart);
Element.addEventListener( drop ,OnDrop);
Element.addEventListener( dragover ,OnDragOver);
Element.addEventListener( dragleave ,OnDragLeave);