2013-03-29 168 views
0

我有兩個框,兩者都可用於拖放事件。我必須一次只突出顯示一個盒子,其中需要發生丟棄功能拖放功能

+0

看看[HTML5的拖拽刪除類和下載](http://www.w3schools.com/html/html5_draganddrop.asp)和捕獲[事件](https://developer.mozilla.org/en-US/docs/DragDrop/Drag_and_Drop)與jQuery。 – hohner

回答

1

當在document上發生拖動事件時檢測。像:

$(document).on("dragstart", ..); 

然後一類添加到要強調:

$("#drop_box").addClass("highlight"); 

然後還remeber再次上"dragend"

+0

'add_class'在jQuery中對我來說很新穎 - 你的意思是'addClass()'http://api.jquery.com/addClass/ ;-) – wildhaber

+0

正確;)我在我自己的框架中「修復」了拼寫。 – Halcyon