bifocal/node_modules/@tryghost/shared-theme-assets/assets/js/v1/main.js

39 lines
1.1 KiB
JavaScript

/* Mobile menu burger toggle */
(function () {
var burger = document.querySelector('.gh-burger');
if (!burger) return;
burger.addEventListener('click', function () {
if (!document.body.classList.contains('is-head-open')) {
document.body.classList.add('is-head-open');
} else {
document.body.classList.remove('is-head-open');
}
});
})();
/* Add lightbox to gallery images */
(function () {
lightbox(
'.kg-image-card > .kg-image[width][height], .kg-gallery-image > img'
);
})();
/* Responsive video in post content */
(function () {
const sources = [
'.gh-content iframe[src*="youtube.com"]',
'.gh-content iframe[src*="youtube-nocookie.com"]',
'.gh-content iframe[src*="player.vimeo.com"]',
'.gh-content iframe[src*="kickstarter.com"][src*="video.html"]',
'.gh-content object',
'.gh-content embed',
];
reframe(document.querySelectorAll(sources.join(',')));
})();
/* Turn the main nav into dropdown menu when there are more than 5 menu items */
(function () {
dropdown();
})();