team.js 875 B

12345678910111213141516171819202122232425262728
  1. var quater = document.getElementsByClassName("team-pic");
  2. var triangle_team = document.getElementsByClassName("point")[0].getElementsByClassName("quater");
  3. var team_description = document.getElementsByClassName("single-team");
  4. var active_triangle = triangle_team[0];
  5. var active_description = team_description[0];
  6. function addListTeam() {
  7. for (var i = 0; i < quater.length; i++) {
  8. quater[i].setAttribute("data", i);
  9. quater[i].addEventListener("click", change_member);
  10. }
  11. }
  12. function change_member(e) {
  13. var value = this.getAttribute("data");
  14. active_triangle.classList.remove("active");
  15. active_description.classList.remove("active");
  16. active_triangle = triangle_team[value];
  17. active_description = team_description[value];
  18. active_triangle.classList.add("active");
  19. active_description.classList.add("active");
  20. }
  21. addListTeam();