string = ".gallery-item, "; string += ".wp-caption > a, "; string += "a:has(img[class*=wp-image-])"; if (navigator.appName == "Microsoft Internet Explorer") { //Set IE as true ie = true; //Create a user agent var var ua = navigator.userAgent; //Write a new regEx to find the version number var re = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"); //If the regEx through the userAgent is not null if (re.exec(ua) != null) { //Set the IE version ieVersion = parseInt(RegExp.$1); } } if (ie = true && ieVersion <= 9) { lightease = ""; } else { lightease = "ease"; } var selector = string.replace(/,\s*$/, ""); jQuery(selector).lightGallery({ caption: true, desc: true, disableOther: true, closable: true, errorMessage: "Could not load the item. Make sure the path is correct and item exist.", easing: lightease }); });