Created
July 2, 2016 18:21
-
-
Save michaelvandenberg/704d3aa916643462646eaecbf0bcbe50 to your computer and use it in GitHub Desktop.
Add .large class to the <p> parent of images wider than 680px. This used to break out large images in posts and pages in the Alpha Centauri WordPress theme.
This file contains hidden or 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
// Add .large class to the <p> parent of images wider than 680px. | |
$( '.entry-content img' ).each( function() { | |
var $this = $( this ); | |
if ( ( $this.attr( 'width' ) > 680 ) && ( $this.parent().is( 'p' ) ) ) { | |
$this.parent().addClass( 'large' ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment