The battle of the standards is constantly a struggle. I found myself needing a solution to the jQuery Click/Double Click problem. This example will send one click or double click to the helper functions. Compatible with Firefox and IE > 6.
var clicktimer; var e_click; var id_click; $(/* Your Sender */).click(function(ev) { var browser=navigator.appName; var b_version=navigator.appVersion; var version=parseFloat(b_version); if((browser=="Microsoft Internet Explorer") && (version==6)) { //Just do the primary action } else { e_click = ev; id_click = this.id; clicktimer = window.setTimeout( "if(e_click) { SingleClickAction(); clearTimeout(clicktimer); clicktimer = null; }", 300); } }).dblclick(function(ev) { window.clearTimeout(clicktimer); e_click = null; id_click = null; DoubleClickAction(); }); function SingleClickAction() { //Do Something } function DoubleClickAction() { //Do Something }
