Wonder if anyone can help me am trying to get it so my pm tabs will scroll left and right but will not pass the final tab.
so if I press the left button the first tab will not be moved left but if I press right tab button it will move to the next tab until that gets to the final tab then it will not move no more and i will need to press left button to move back so on screen shot at the bottom on how tabs look
here my JS code
const container = document.querySelector(".pm-tab");
const leftBtn = document.querySelector(".leftBtn");
const rightBtn = document.querySelector(".rightBtn");
let translate = 0;
leftBtn.addEventListener("click", function() {
var num = $("#tabs").find("li").length;
if (num > 5) {
translate += 15;
container.style.transform = "translateX(" + translate + "px" + ")";
}
});
rightBtn.addEventListener("click", function() {
var num = $("#tabs").find("li").length;
if (num > 5) {
translate -= 15;
container.style.transform = "translateX(" + translate + "px" + ")";
}
});
hope some one can help thanks.
box-chat-tabs-style.css