? js/mpb-lightbox2.patch Index: js/lightbox.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/lightbox2/js/lightbox.js,v retrieving revision 1.5.2.6.2.120 diff -u -r1.5.2.6.2.120 lightbox.js --- js/lightbox.js 13 Sep 2009 23:27:32 -0000 1.5.2.6.2.120 +++ js/lightbox.js 6 Nov 2009 20:51:38 -0000 @@ -623,8 +623,7 @@ } else { if (Lightbox.isVideo) { - $("#modalContainer").html(Lightbox.modalHTML); - $("#modalContainer").click(function() { return false; } ); + $("#modalContainer").html(Lightbox.modalHTML).click(function(){return false;}).css('zIndex', '10500').show(); } else { var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]); @@ -632,11 +631,13 @@ $(src).appendTo("#modalContainer"); } else { - $("#modalContainer").load(src); + // Use a callback to show the new image, otherwise you get flicker. + $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show();}); } $('#modalContainer').unbind('click'); } - $('#modalContainer').css({'zIndex': '10500'}).show(); + // This might be needed in the Lightframe section above. + //$('#modalContainer').css({'zIndex': '10500'}).show(); } } @@ -782,7 +783,9 @@ // If not first image in set, display prev image button. if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) { - $(prevLink).css({'zIndex': '10500'}).show().click(function() { + // Unbind any other click handlers, otherwise this adds a new click handler + // each time the arrow is clicked. + $(prevLink).css({'zIndex': '10500'}).show().unbind().click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; }); } @@ -793,7 +796,9 @@ // If not last image in set, display next image button. if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) { - $(nextLink).css({'zIndex': '10500'}).show().click(function() { + // Unbind any other click handlers, otherwise this adds a new click handler + // each time the arrow is clicked. + $(nextLink).css({'zIndex': '10500'}).show().unbind().click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; }); }