Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. document.addEventListener("DOMContentLoaded", function() {
  2. // Zadanie 1
  3. document.querySelectorAll(".parent").forEach(function(el) {
  4. el.addEventListener("mouseover", function() {
  5. el.querySelector(".children").style.display = "block";
  6. })
  7. })
  8. // document.querySelectorAll(".parent").forEach(function(el) {
  9. // el.addEventListener("mouseout", function() {
  10. // el.querySelector(".children").style.display = "none";
  11. // })
  12. // })
  13. function hideChildrenElement(e) {
  14. console.log(e);
  15. this.querySelector(".children").style.display = "none";
  16. }
  17. document.querySelectorAll(".parent").forEach(function(el) {
  18. el.addEventListener("mouseout", hideChildrenElement);
  19. })
  20. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement