Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class calculator {
- constructor(){
- this.calcTitle = document.getElementsByClassName("calculator-title");
- this.calcSection = document.getElementsByClassName("calculator-info");
- }
- hidetabcontect(){
- for (var i = 0; i < this.calcTitle.length; i++) {
- this.calcSection[i].style.display = "none";
- this.calcTitle[i].classList.remove("active");
- }
- }
- tabcalc(){
- for (let i = 0; i < this.calcTitle.length; i++) {
- this.calcTitle[i].addEventListener("click", (e) => {
- e.preventDefault();
- hidetabcontect();
- this.calcTitle[i].classList.add("active");
- $(`.calculator-info:eq(${i})`).fadeTo("slow", 1);
- })
- }
- };
- }
- let calculatorOne = new calculator();
- calculatorOne.tabcalc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement