Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. class calculator {
  2. constructor(){
  3. this.calcTitle = document.getElementsByClassName("calculator-title");
  4. this.calcSection = document.getElementsByClassName("calculator-info");
  5. }
  6. hidetabcontect(){
  7. for (var i = 0; i < this.calcTitle.length; i++) {
  8. this.calcSection[i].style.display = "none";
  9. this.calcTitle[i].classList.remove("active");
  10. }
  11. }
  12. tabcalc(){
  13. for (let i = 0; i < this.calcTitle.length; i++) {
  14. this.calcTitle[i].addEventListener("click", (e) => {
  15. e.preventDefault();
  16. hidetabcontect();
  17. this.calcTitle[i].classList.add("active");
  18. $(`.calculator-info:eq(${i})`).fadeTo("slow", 1);
  19. })
  20. }
  21. };
  22. }
  23. let calculatorOne = new calculator();
  24. calculatorOne.tabcalc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement