Hello Every One,
I want to support different behaviour when single click on DIV and double click on DIV. When Dbl Click is done, browser is generating 2 single clk and 1 dlbclk events.
How to differentiate in single clk about whether it is due to double clk or single clk. I need to support both IE and FF.
Thanks for the prompt response.DIV support onclick event and ondblevent.. Whenever dblclick is done on the DIV then onclick event is called two times. May i know how to handle onclick based on ondblclick status
You have used timeout of 250ms, but user can change the time interval for double click from controlpanel. If user make more delay for double click then the able logic will fail. How to avoid this situation. Problem is only in Firefox, IE has handled single and double click correctly
Hi mrhoo,
Thanks for the response. You have used timeout of 250ms, but user can change the time interval(speed) for double click from controlpanel(mouse - double click speed). If user make more delay for double click then the timeout will fail. How to avoid this situation. Problem is only in Firefox, IE has handled single and double click correctly
You could simplify things by handling single or double clicks from the click event,
and ignore dblclick-
this is also more accessible, there is no good dblclick keyboard equivilent.
Code:
var clicktimer;
element.onclick= function(e){
e= window.event || e;
if(clicktimer){
clearTimeout(clicktimer);
clicktimer= null;
//do two click event
}
else clicktimer= setTimeout(function(e){
clicktimer= null;
/* single click code*/
},500);
}
Bookmarks