html - Javascript double-click does not work in IE9 and IE11 -
in javascript code, single-click opens link in new tab , double-click opens light-box. works ok in browsers except in ie9 , ie11. in first code, both single-click , double-click work single-click, ie gives message, "allow pop-up?" want ie open link in new tab w/o message other browsers. in second code, single-click works want second click of double- click in ie gets ignored , ends working single-click. can done remove issue - either in first code or in second code - perhaps missing?
first code:
$('div[id^="jzl_"].short').click(function(e) { var $this = $(this); var currentid = e.target.id; if ($this.hasclass('clicked')) { $this.removeclass('clicked'); $.colorbox({ href : "getinfo1.php?id=" + currentid, overlayclose : false, top : "16%" }); //$.colorbox({ overlayclose: false }); //alert("double click"); //here code double click } else { $this.addclass('clicked'); settimeout(function() { if ($this.hasclass('clicked')) { $this.removeclass('clicked'); // alert("just 1 click!"); var jobsite = window.open('', '_blank'); sleep(1000); var redirct = getpage(currentid); sleep(1000); jobsite.location = redirct; //var redirct = getpage(currentid); //window.open(redirct, '_newtab' + math.floor(math.random() * 999999)); } }, 500); } });
second code:
$('div[id^="jzl_"].short').click(function(e) { var $this = $(this); var currentid = e.target.id; var jobsite = window.open('', '_blank'); if ($this.hasclass('clicked')) { $this.removeclass('clicked'); $.colorbox({ href : "getinfo1.php?id=" + currentid, overlayclose : false, top : "16%" }); //$.colorbox({ overlayclose: false }); //alert("double click"); //here code double click } else { $this.addclass('clicked'); settimeout(function() { if ($this.hasclass('clicked')) { $this.removeclass('clicked'); // alert("just 1 click!"); var redirct = getpage(currentid); jobsite.location = redirct; //var redirct = getpage(currentid); //window.open(redirct, '_newtab' + math.floor(math.random() * 999999)); } }, 500); } });
you should use both .click() , .dblclick() instead of testing whether or not element has clicked
class. here new code:
$('div[id^="jzl_"].short').dblclick(function(e) { var $this = $(this); var currentid = e.target.id; $.colorbox({ href : "getinfo1.php?id=" + currentid, overlayclose : false, top : "16%" }); //$.colorbox({ overlayclose: false }); //alert("double click"); //here code double click }); $('div[id^="jzl_"].short').click(function(e) { var $this = $(this); var currentid = e.target.id; var jobsite = window.open('', '_blank'); var redirct = getpage(currentid); jobsite.location = redirct; //var redirct = getpage(currentid); //window.open(redirct, '_newtab' + math.floor(math.random() * 999999)); });
Comments
Post a Comment