Web page of meissner-wohnen.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.9 KiB

  1. (function() {
  2. var wohnung = document.getElementsByClassName("wohnung-img"),
  3. kueche = document.getElementsByClassName("kueche-img"),
  4. bad = document.getElementsByClassName("bad-img"),
  5. index = 0;
  6. var setActive = function (element) {
  7. document.getElementById(element).classList.add("active");
  8. };
  9. var setDeactive = function (element) {
  10. document.getElementById(element).classList.remove("active");
  11. };
  12. for (index=0; index <= wohnung.length-1; index++) {
  13. if (wohnung[index].addEventListener) {
  14. wohnung[index].addEventListener("mouseenter", function(){setActive("wohnung")}, false);
  15. wohnung[index].addEventListener("mouseleave", function(){setDeactive("wohnung")}, false);
  16. } else {
  17. wohnung.attachEvent("onmouseenter", function(){setActive("wohnung")});
  18. wohnung.attachEvent("onmouseleave", function(){setDeactive("wohnung")});
  19. }
  20. }
  21. for (index=0; index <= kueche.length-1; index++) {
  22. if (kueche[index].addEventListener) {
  23. kueche[index].addEventListener("mouseenter", function(){setActive("kueche")}, false);
  24. kueche[index].addEventListener("mouseleave", function(){setDeactive("kueche")}, false);
  25. } else {
  26. kueche.attachEvent("onmouseenter", function(){setActive("kueche")});
  27. kueche.attachEvent("onmouseleave", function(){setDeactive("kueche")});
  28. }
  29. }
  30. for (index=0; index <= bad.length-1; index++) {
  31. if (bad[index].addEventListener) {
  32. bad[index].addEventListener("mouseenter", function(){setActive("bad")}, false);
  33. bad[index].addEventListener("mouseleave", function(){setDeactive("bad")}, false);
  34. } else {
  35. bad.attachEvent("onmouseenter", function(){setActive("bad")});
  36. bad.attachEvent("onmouseleave", function(){setDeactive("bad")});
  37. }
  38. }
  39. }());