Guest User

Untitled

a guest
Jul 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. /<div class="container" id="container">
  2. </div>
  3.  
  4. .container{
  5. display: grid;
  6. grid-template-columns: repeat(16, 1fr);
  7. grid-auto-rows: repeat(16, 1fr);
  8. width: 95%;
  9. height: 95%;
  10. border: 1px solid black;
  11. margin: auto;
  12. }
  13.  
  14. #block{
  15. background: white;
  16. padding: 12.5px;
  17. }
  18.  
  19. #block:hover{
  20. background:;
  21. }
  22.  
  23. .color{
  24. background: rgba{0,0,0,0.1}
  25. }
  26.  
  27. for (var i=0; i<(16*16); i++){
  28. var iDiv = document.createElement('div');
  29. iDiv.textContent = " ";
  30. iDiv.id = 'block';
  31. iDiv.className = 'block';
  32. var container = document.getElementById("container");
  33.  
  34. container.appendChild(iDiv);
  35.  
  36. iDiv.addEventListener("mouseover", function( event ) {
  37. // highlight the mouseover target
  38. this.style.backgroundColor = "black";
  39. this.style.opacity += 0.2;
  40.  
  41. // reset the color after a short delay
  42. setTimeout(function() {
  43. this.target.style.color = " ";
  44. }, 500);
  45. }, false);
  46.  
  47. }
Add Comment
Please, Sign In to add comment