Advertisement
rozman50

Untitled

Apr 20th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <div class="wrapper">
  5. <div id="bgc"></div>
  6. <img src="https://diagnostika-clarus.si/uploads/clarus/public/_custom/nevarna_kona_znamenja_in_izrastki2.jpg">
  7. <span id="x">X</span>
  8. </div>
  9. <button id="skrij">Skrij</button>
  10. </body>
  11. </html>
  12.  
  13. <style>
  14. .wrapper {
  15. position: relative;
  16. max-width: 600px;
  17. max-height: 600px;
  18. }
  19.  
  20. .wrapper img {
  21. width: 600px;
  22. height: 600px;
  23. }
  24. #bgc {
  25. position: absolute;
  26. width: 100%;
  27. height: 100%;
  28. background-color: rgb(173, 216, 230, 0.5);
  29. display: none;
  30.  
  31. }
  32. #x {
  33. top: 15px;
  34. right: 15px;
  35. position: absolute;
  36. display: block;
  37. height: 20px;
  38. width: 20px;
  39. line-height: 20px;
  40. -moz-border-radius: 50%; /* or 50% */
  41. border-radius: 50%; /* or 50% */
  42. border: 1px solid black;
  43. text-align: center;
  44. font-size: 15px;
  45. cursor: pointer;
  46. display: none;
  47.  
  48. }
  49. </style>
  50.  
  51. <script>
  52.  
  53. var xButton = document.querySelector('#x');
  54. var bgc = document.querySelector('#bgc');
  55. var skrij = document.querySelector("#skrij");
  56. xButton.addEventListener('click', function(e) {
  57. bgc.style.display = "none";
  58. xButton.style.display = "none";
  59. skrij.disabled = false;
  60. });
  61.  
  62. skrij.addEventListener('click', function(e) {
  63. bgc.style.display = "initial";
  64. xButton.style.display = "initial";
  65. e.target.disabled = true;
  66. })
  67.  
  68. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement