pianello-api/resources/js/components/dark-mode-switcher/index.js

18 lines
490 B
JavaScript
Raw Permalink Normal View History

(function () {
"use strict";
// Dark mode switcher
$(".dark-mode-switcher").on("click", function () {
if ($(this).hasClass("dark-mode-switcher--active")) {
$(this).removeClass("dark-mode-switcher--active");
} else {
$(this).addClass("dark-mode-switcher--active");
}
setTimeout(() => {
const link = $(".dark-mode-switcher").data("url");
window.location.href = link;
}, 500);
});
})();