web/_javascript/utils/img-extra.js
2022-12-24 23:51:47 +08:00

28 lines
615 B
JavaScript

/**
* Set up image stuff
*/
(function() {
if ($('#core-wrapper img[data-src]') <= 0) {
return;
}
/* See: <https://github.com/dimsemenov/Magnific-Popup> */
$('.popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
showCloseBtn: false,
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out'
}
});
/* Stop shimmer when image loaded */
document.addEventListener('lazyloaded', function(e) {
const $img = $(e.target);
$img.parent().removeClass('shimmer');
});
})();