Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save muks999/bb68206afecfc7496ee4c9dd0f94910d to your computer and use it in GitHub Desktop.
Save muks999/bb68206afecfc7496ee4c9dd0f94910d 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