[Plugin: WP jQuery Lightbox] Title-captions Bug found, solved, and fix proposed
-
Hi Ulf,
Thanks first of all for such a simple and elegant lightbox solution for wordpress.However I found a bug and coded in a little solution.
Bug
If some images in a set have the link title set and the rest of the images do not then this bug happens:
When flipping through the lightbox pages the title-less links should not have a caption. However all the title-less images in the set will contain the last image’s caption when flipping through. In other words, there’s no code that says “hey if this image doesn’t have the ahref title element set, then hide the caption.You can replicate this bug by creating a set of 2 images in a post and then give only one of their surround link’s a title attribute. The caption will show up for the image with the titled link and will carry over to the image with the un-titled link (even tho this image should not have a caption).
I found this code in the original jquery lightbox plugin and inserted it into your wp plugin. It hides the caption just before each image is paged into view and only shows it if the title actually contains something. It’s just 2 lines of code:
——————————————
function updateDetails() { jQuery('#numberDisplay').html(''); /* BEGIN ADDITION */ $('#imageDataContainer').slideDown('fast');//<-- important but missing from your version $('#caption').hide();//<-- important but missing from your version /* END ADDITION */ if(opts.imageArray[opts.activeImage][1]){ jQuery('#caption').html(opts.imageArray[opts.activeImage][1]).show(); }
——————————————
I beg you to make an awesome plugin even closer to perfect and add this code then update the plugin in the wordpress plugin repository.
Thanks for your port, it’s my favorite.
- The topic ‘[Plugin: WP jQuery Lightbox] Title-captions Bug found, solved, and fix proposed’ is closed to new replies.