Major Caption Bug
-
I found and fixed a major issue with captions.
To reproduce, in the body of a post, have a small (250 pixel) image followed by a 500px image. Captions on both.
The javascript will use the caption div width of the first smaller image for calculations on the second larger image, resulting in a shrunken image.
Fix:
Lines 31-37:
var capw = jQuery(‘.wp-caption’).width();
// Remove the style attribute from .wp-caption
jQuery(‘.wp-caption’).removeAttr(‘style’);
// Calculate the width of .wp-caption as a percentage of the width of .hentry
var caperc = ((capw / postw) * 100);
// Write a style attribute with width as a percentage
jQuery(‘.wp-caption’).attr(‘style’,’width:’ + caperc + ‘%;’);to
var capw = jQuery(this).parent(‘.wp-caption’).width();
// Remove the style attribute from .wp-caption
jQuery(‘.wp-caption’).removeAttr(‘style’);
// Calculate the width of .wp-caption as a percentage of the width of .hentry
var caperc = ((capw / postw) * 100);
// Write a style attribute with width as a percentage
jQuery(this).parent(‘.wp-caption’).attr(‘style’,’width:’ + caperc + ‘%;’);
- The topic ‘Major Caption Bug’ is closed to new replies.