2021-04-21 18:17:34 +03:00
|
|
|
/**
|
2022-12-09 02:03:13 +03:00
|
|
|
Set up image popup stuff (https://github.com/dimsemenov/Magnific-Popup)
|
2022-10-25 14:26:44 +03:00
|
|
|
*/
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
$(function () {
|
|
|
|
const IMG_SCOPE = '#main > div.row:first-child > div:first-child';
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
if ($(`${IMG_SCOPE} img`).length <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
/* popup */
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
$(`${IMG_SCOPE} p > img[data-src], ${IMG_SCOPE} img[data-src].preview-img`).each(
|
|
|
|
function () {
|
|
|
|
let nextTag = $(this).next();
|
|
|
|
const title = nextTag.prop('tagName') === 'EM' ? nextTag.text() : '';
|
|
|
|
const src = $(this).attr('data-src'); // created by lozad.js
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
$(this).wrap(`<a href="${src}" title="${title}" class="popup"></a>`);
|
|
|
|
}
|
|
|
|
);
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
$('.popup').magnificPopup({
|
|
|
|
type: 'image',
|
|
|
|
closeOnContentClick: true,
|
|
|
|
showCloseBtn: false,
|
|
|
|
zoom: {
|
|
|
|
enabled: true,
|
|
|
|
duration: 300,
|
|
|
|
easing: 'ease-in-out'
|
|
|
|
}
|
|
|
|
});
|
2021-04-21 18:17:34 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
/* markup the image links */
|
2021-06-30 14:08:42 +03:00
|
|
|
|
2022-10-25 14:26:44 +03:00
|
|
|
$(`${IMG_SCOPE} a`).has('img').addClass('img-link');
|
2021-07-19 18:22:04 +03:00
|
|
|
|
2021-04-21 18:17:34 +03:00
|
|
|
});
|