The conflict with jQuery 1.9 is due to a new behavior for the .after () method . You can rewrite the Lightbox.prototype.build method to lightbox to avoid using the .after () method for disabled nodes, and lightbox will work with jQuery 1.9 again.
The following is my quickly hacked solution (what works). It could have been cleaned up with a lot of chaining, but I decided to leave it for a later one or maybe just wait until Lightbox v2.51 is updated to include a standardized fix.
Lightbox.prototype.build = function() { var $lightbox, _this = this; // Editing here for jQuery 1.9 conflict $("<div>", { "id": "lightboxOverlay" }).appendTo("body"); lightbox = $("<div>", { "id": "lightbox" }); outerContainer = $("<div>", { "class": "lb-outerContainer" }); container = $("<div>", { "class": "lb-container" }); $(container).append($("<img>", { "class": "lb-image" })); nav = $("<div>", { "class": "lb-nav" }); $(nav).append($("<a>", { "class": "lb-prev" })); $(nav).append($("<a>", { "class": "lb-next" })); loader = $("<div>", { "class": "lb-loader" }); $(loader).append($("<a>", { "class": "lb-cancel" }).append($("<img>", { "src": this.options.fileLoadingImage }))); $(container).append(nav); $(container).append(loader); $(outerContainer).append(container); dataContainer = $("<div>", { "class": "lb-dataContainer" }); data = $("<div>", { "class": "lb-data" }); details = $("<div>", { "class": "lb-details" }); $(details).append($("<span>", { "class": "lb-caption" })); $(details).append($("<span>", { "class": "lb-number" })); closeContainer = $("<div>", { "class": "lb-closeContainer" }); $(closeContainer).append($("<a>", { "class": "lb-close" }).append($("<img>", { "src": this.options.fileCloseImage }))); $(data).append(details); $(data).append(closeContainer); $(dataContainer).append(data); $(lightbox).append(outerContainer); $(lightbox).append(dataContainer); $(lightbox).appendTo("body"); // End custom changes $('#lightboxOverlay').hide().on('click', function(e) { _this.end(); return false; }); $lightbox = $('#lightbox'); $lightbox.hide().on('click', function(e) { if ($(e.target).attr('id') === 'lightbox') _this.end(); return false; }); $lightbox.find('.lb-outerContainer').on('click', function(e) { if ($(e.target).attr('id') === 'lightbox') _this.end(); return false; }); $lightbox.find('.lb-prev').on('click', function(e) { _this.changeImage(_this.currentImageIndex - 1); return false; }); $lightbox.find('.lb-next').on('click', function(e) { _this.changeImage(_this.currentImageIndex + 1); return false; }); $lightbox.find('.lb-loader, .lb-close').on('click', function(e) { _this.end(); return false; }); };
jonesbp
source share