Skip to content

Instantly share code, notes, and snippets.

@zaurmag
Created January 9, 2018 08:47
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 zaurmag/9dafcb116e98c4faef288b878638191a to your computer and use it in GitHub Desktop.
Save zaurmag/9dafcb116e98c4faef288b878638191a to your computer and use it in GitHub Desktop.
Wrap image figure tag
// ================ Wrap img in content HTML5 tags ================
var imgContent = $('.page__body.textblock a.popup-video img');
imgContent.each(function() {
$this = $(this);
var imgTitle = $this.attr('title');
if (imgTitle) {
$this.parent('.popup-video').wrap('<figure class="content-image"></figure>');
$this.parent('.popup-video').append('<figcaption class="content-image__title">' + imgTitle + '</figcaption>');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment