var btnContainer2 = document.getElementById("subtopnav2");
var btns2 = btnContainer2.getElementsByClassName("btn");
for (var i = 0; i < btns2.length; i++) {
btns2[i].addEventListener("click", function () {
addActiveClass("section2", this);
filterSelection("section2", this.textContent.trim());
});
}
</script>
In this version, I’ve added a section parameter to the filter functions to distinguish between the two sections. Additionally, I modified the event listeners for filter buttons to use the new functions and pass the appropriate section identifier.
Make sure to replace your existing script with this modified version. This should resolve conflicts between the two sections.