views:

118

answers:

0

this is my code, and I can't remove the mousedown eventlistener :

//***********  double right click ********/

var c =0 ;
function time(event){
  if(event.button == 2){
    c++;
    setTimeout(cc, 600);
  }
 if (c >1){
     alert('ok i get it')
  }
}
//$('#map_canvas')[0].mousedown(time);
$('#map_canvas')[0].addEventListener('mousedown', time, false);
//$("map_canvas").unbind() 
//$('map_canvas')[0].onmousedown=function(){};//this can't be clear the event
$('map_canvas')[0].removeEventListener('mousedown', time, false);

function cc(){
  c=0;
}
//***********  double right click ********/