Last active
December 15, 2015 03:09
-
-
Save mattonomics/5192165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adjust_caption() { | |
var captions = document.getElementsByClassName('wp-caption'); | |
for (var i = 0; i < captions.length; i++) { | |
// set wrap to auto | |
captions[i].style.width = 'auto'; | |
// will set the width of the p to the same as the image. comment out if you don't want/need | |
captions[i].getElementsByTagName('p')[0].style.width = captions[i].getElementsByTagName('img')[0].width + 'px'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment