Skip to content

Instantly share code, notes, and snippets.

@artikus11
Last active October 9, 2018 13:02
Show Gist options
  • Save artikus11/b0a8393bc5e432876729d1406c1e515e to your computer and use it in GitHub Desktop.
Save artikus11/b0a8393bc5e432876729d1406c1e515e to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
$(".post__body").magnificPopup({
delegate: "p a[href$='.jpg'],p a[href$='.jpeg'],p a[href$='.gif'],p a[href$='.png']",
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
},
});
$('.gallery').magnificPopup({
delegate: '.gallery-item a',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
},
image: {
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
titleSrc: function(item) {
var textImgGal = item.el.parents('.gallery-item').find('.wp-caption-text').html();
console.log(textImgGal);
if (textImgGal !== undefined) {
return item.el.parents('.gallery-item').find('.wp-caption-text').html() + '<small>Фокусы от Моряка</small>';
} else {
return '<small>Фокусы от Моряка</small>';
}
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment