passesFrontend/static/scripts/helpPopup.js

37 lines
971 B
JavaScript
Raw Permalink Normal View History

2024-05-15 13:27:22 +00:00
function toggleDropdown(dropdownId) {
$(".dropdown-help")
.not("#" + dropdownId)
.removeClass("is-visible");
setTimeout(function () {
$(".dropdown-help")
.not("#" + dropdownId)
.css("display", "none");
}, 200);
const dropdownHelp = $("#" + dropdownId);
if (dropdownHelp.hasClass("is-visible")) {
event.preventDefault();
dropdownHelp.removeClass("is-visible");
setTimeout(function () {
dropdownHelp.css("display", "none");
}, 200);
} else {
event.preventDefault();
dropdownHelp.css("display", "inline-flex");
dropdownHelp.addClass("is-visible");
}
}
$(document).on("click", function (event) {
if ($(event.target).closest(".help-button").length) {
return;
} else {
if (!$(event.target).closest(".dropdown-help").length) {
$(".dropdown-help").removeClass("is-visible");
setTimeout(function () {
$(".dropdown-help").css("display", "none");
}, 200);
}
}
});