Created
January 9, 2018 08:47
-
-
Save zaurmag/9dafcb116e98c4faef288b878638191a to your computer and use it in GitHub Desktop.
Wrap image figure tag
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
// ================ 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