Last active
July 4, 2016 19:57
-
-
Save aramboyajyan/5cd54f2a7f3c7731a28713bd3b86d894 to your computer and use it in GitHub Desktop.
Add a class to all images that are aligned left or right
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
img.float-left { | |
float: left!important; | |
margin: 6px 12px 10px 0!important; | |
} | |
img.float-right { | |
float: right!important; | |
margin: 6px 0 12px 10px!important; | |
} |
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
$('#content img').each(function() { | |
var $this = $(this); | |
if ($this.css('float') === 'left') { | |
$this.addClass('float-left'); | |
} | |
else if ($this.css('float') === 'right') { | |
$this.addClass('float-right'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment