mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-22 15:42:38 +00:00
perf: replace jQuery with Vanilla JS (#1681)
Also replaced `magnific-popup` with `GLightbox`
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
/**
|
||||
* Set up image popup
|
||||
*
|
||||
* See: https://github.com/dimsemenov/Magnific-Popup
|
||||
* Dependencies: https://github.com/biati-digital/glightbox
|
||||
*/
|
||||
|
||||
const IMG_CLASS = 'popup';
|
||||
|
||||
export function imgPopup() {
|
||||
if ($('.popup') <= 0) {
|
||||
if (document.getElementsByClassName(IMG_CLASS).length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.popup').magnificPopup({
|
||||
type: 'image',
|
||||
closeOnContentClick: true,
|
||||
showCloseBtn: false,
|
||||
zoom: {
|
||||
enabled: true,
|
||||
duration: 300,
|
||||
easing: 'ease-in-out'
|
||||
}
|
||||
});
|
||||
GLightbox({ selector: `.${IMG_CLASS}` });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user