dragAndDrop
將項目拖曳到目標元素或位置。
資訊
此命令的功能很大程度上取決於您的應用程式中拖放的實作方式。 如果您遇到問題,請在 #4134 中發布您的範例。
用法
$(selector).dragAndDrop(target, { duration })
參數
名稱 | 類型 | 詳細資訊 |
---|---|---|
target | Element 、DragAndDropCoordinate | 具有 x 和 y 屬性的目標元素或物件 |
options 選填 | DragAndDropOptions | dragAndDrop 命令選項 |
options.duration 選填 | 數字 | 拖曳應持續多久 |
範例
example.test.js
it('should demonstrate the dragAndDrop command', async () => {
const elem = await $('#someElem')
const target = await $('#someTarget')
// drag and drop to other element
await elem.dragAndDrop(target)
// drag and drop relative from current position
await elem.dragAndDrop({ x: 100, y: 200 })
})