Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. var div, nodes;
  6. function fclick(e){
  7. var target_initial=e.target;
  8. var target_curent=e.currentTarget;
  9. if (target_curent.tagName!="div")
  10. {
  11. if(e.stopPropagation)
  12. e.stopPropagation()
  13. else
  14. e.cancelBubbling=true;
  15. }
  16. else {
  17. alert("Elementele sunt inactive");
  18. }
  19. }
  20. window.onload = function(){
  21. div = document.getElementsByTagName("div");
  22. nodes = div[0].children;
  23. div[0].addEventListener("click",fclick);
  24. for(var i = 0; i < nodes.length; ++i)
  25. nodes[i].addEventListener("click",fclick);
  26. }
  27. </script>
  28. <style>
  29. body{
  30. margin: 0;
  31. padding: 0;
  32. }
  33. div{
  34. position: absolute;
  35. width: 300px;
  36. height: 300px;
  37. background: red;
  38. right: 0;
  39. }
  40. div:hover{
  41. width: 600px;
  42. height: 600px;
  43. background: yellow;
  44. transition: 2s;
  45. }
  46. div:hover>*:first-child{
  47. border: 1px solid green;
  48. transition: 2s;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div>
  54. <p>asdnk</p>
  55. <h1>asndjks</h1>
  56. <ul>
  57. <li>sdbnjks</li>
  58. </ul>
  59. </div>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement