Something went wrong. Try again.
Joseph Hale's Technical Blog
Something went wrong. Try again.
498 B · 21 lines
JavaScript
at commit eaeb6d64
12345678910111213141516171819202122/** * Add listener for theme mode toggle */const $toggleElem = $('.mode-toggle');
export function modeWatcher() { if ($toggleElem.length === 0) { return; }
$toggleElem.off().on('click', (e) => { const $target = $(e.target); let $btn = $target.prop('tagName') === 'button'.toUpperCase() ? $target : $target.parent();
modeToggle.flipMode(); // modeToggle: `_includes/mode-toggle.html` $btn.trigger('blur'); // remove the clicking outline });}