function toggleFooterWidgets() {
if ($(window).width() <= 768) { // Mobile only
$(".widget").each(function() { // Target all widgets dynamically
let widgetContent = $(this).find("div").first(); // Get first div inside the widget
if (!$(this).find(".toggle-arrow").length) {
$(this).find(".widget-title").append(' ▼');
}
widgetContent.hide(); // Hide widget content by default
$(this).find(".widget-title").off("click").on("click", function() {
widgetContent.slideToggle();
$(this).toggleClass("active");
});
});
} else {
$(".widget div").show(); // Show all on desktop
}
}
toggleFooterWidgets();
$(window).resize(toggleFooterWidgets);
});