Hi there community i managed to create that code that works as tabs function. Every tab has a collection that change with click on other tab, every collection if has more than 4 products it shows some button like "see all". I need to add that on the function changeTab. Here is the code i create;
tabs = document.querySelectorAll(".featured-products-section__tab");
tabContents = document.querySelectorAll(".featured-products-section__products");
tabViewAll = document.querySelectorAll(".featured-products-section__view-all");
tabs.forEach(function (tab) {
tab.addEventListener("click", function () {
contentId = this.dataset.contentId;
content = document.getElementById(contentId);
tabContents.forEach(function (content) {
content.classList.remove("active");
});
tabs.forEach(function (tab) {
tab.classList.remove("active");
});
this.classList.add("active");
content.classList.add("active");
});
});
.featured-products-section__view-all.active {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
}
.featured-products-section__view-all {
display: none;
}
I create a new var called tabViewAll to get that button, but where i have to add it? i tried some ways but unfortunatly no one worked.