2013-10-09 42 views
0

我正在構建一個HTML5 canvas應用程序。因爲我在不同的時間使用了許多'mousemouse','mousedown'事件處理程序。我可以刪除附加到畫布上的所有事件處理程序,只指定事件'mousemove'(不指定其回調函數)。從html5 Canvas中移除所有事件處理程序

+0

像['。對()/.off()'](http://api.jquery.com/off/)? – Spokey

+2

我認爲「mousemouse」的意思是「mouseup」正確嗎? – Twocode

+0

也許這有助於:http://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object – Moby04

回答

1

用途:

$("selector").unbind("click"); 

另一種方法是off()

$("p").off("click", "**"); 

這將從所有段落刪除所有委託點擊處理程序jQuery.unbind()jQuery.off()

0

純JavaScript:

var canvas = ...; 
canvas.removeEventListener('eventIDontWantAnymore', arguments.callee, false); 

JSFiddle

相關問題