Guest User

Untitled

a guest
Feb 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. const bg = document.querySelector(".bg");
  2. const circles = document.querySelectorAll(".circle");
  3.  
  4. circles.forEach(circle => circle.addEventListener("mouseenter", (e) => {
  5. const style = getComputedStyle(e.target);
  6. const backgroundColor = style.backgroundColor;
  7.  
  8. bg.style.backgroundColor = backgroundColor;
  9. }))
  10.  
  11. .bg p {
  12. opacity: 0;
  13. }
  14.  
  15. .red.circle:hover ~ .bg .red {
  16. background-color: red;
  17. opacity: 1;
  18. }
  19.  
  20. ...
Add Comment
Please, Sign In to add comment