2012-12-20 32 views
4

拖我有一個dragable項目,但它是在其他HTML元素,當我拖動它,甚至我設置.item_dragable { cursor: move; z-index: 2147483646; } 和事件dragable:元素不能擁有的z-index最高時的jQuery

jQuerydragable.draggable({ 
    cancel: "a.ui-icon", // clicking an icon won't initiate dragging 
    revert: "invalid", // when not dropped, the item will revert back to its initial position 
    containment: "document", 
    helper: "clone", 
    cursor: "move", 
    zIndex: 2147483647 
}); 

什麼錯是嗎?我用的是最新的jQuery和jQuery UI的

感謝

+2

您是否檢查過父元素?請提供一個jsfiddle或工作示例。 – jtheman

+0

我在另一個元素中的可拖動項,是它的父指向的z索引辯護元素? – user1912285

+0

某些HTML代碼會幫助 – wakooka

回答

4

,最好的辦法讓你的可拖動的項目會在一切被使用的選項appendTo(見jQuery UI doc)並將其設置爲"body"這樣的:

jQuerydragable.draggable({ 
    cancel: "a.ui-icon", // clicking an icon won't initiate dragging 
    revert: "invalid", // when not dropped, the item will revert back to its initial position 
    containment: "document", 
    helper: "clone", 
    cursor: "move", 
    zIndex: 100000, 
    appendTo: "body" 
}); 

並且當然設置了一個足夠大的z-索引以高於所有其他索引。

+0

非常感謝你,我解決了這個問題 – user1912285

相關問題