My JavaScript code has an issue where single-click opens a link in a new tab and double-click opens a lightbox. This works perfectly in all browsers except for IE9 and IE11. In my initial code, both single-click and double-click function correctly. However, when single-clicking in IE, a popup message appears asking "allow pop-up?" I want IE to open the link in a new tab without this message just like the other browsers. In my updated code, single-click works as intended, but the second click of a double-click in IE is ignored and ends up functioning as a single-click. Is there something that can be adjusted in either the first or second code that I might have overlooked?
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%"
});
} else {
$this.addClass('clicked');
setTimeout(function() {
if ($this.hasClass('clicked')) {
$this.removeClass('clicked');
var jobSite = window.open('', '_blank');
sleep(1000);
var redirct = getPage(currentID);
sleep(1000);
jobSite.location = redirct;
}
}, 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%"
});
} else {
$this.addClass('clicked');
setTimeout(function() {
if ($this.hasClass('clicked')) {
$this.removeClass('clicked');
var redirct = getPage(currentID);
jobSite.location = redirct;
}
}, 500);
}
});