Skip to content

Instantly share code, notes, and snippets.

@aramboyajyan
Last active July 4, 2016 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aramboyajyan/5cd54f2a7f3c7731a28713bd3b86d894 to your computer and use it in GitHub Desktop.
Save aramboyajyan/5cd54f2a7f3c7731a28713bd3b86d894 to your computer and use it in GitHub Desktop.
Add a class to all images that are aligned left or right
img.float-left {
float: left!important;
margin: 6px 12px 10px 0!important;
}
img.float-right {
float: right!important;
margin: 6px 0 12px 10px!important;
}
$('#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