Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- var div, nodes;
- function fclick(e){
- var target_initial=e.target;
- var target_curent=e.currentTarget;
- if (target_curent.tagName!="div")
- {
- if(e.stopPropagation)
- e.stopPropagation()
- else
- e.cancelBubbling=true;
- }
- else {
- alert("Elementele sunt inactive");
- }
- }
- window.onload = function(){
- div = document.getElementsByTagName("div");
- nodes = div[0].children;
- div[0].addEventListener("click",fclick);
- for(var i = 0; i < nodes.length; ++i)
- nodes[i].addEventListener("click",fclick);
- }
- </script>
- <style>
- body{
- margin: 0;
- padding: 0;
- }
- div{
- position: absolute;
- width: 300px;
- height: 300px;
- background: red;
- right: 0;
- }
- div:hover{
- width: 600px;
- height: 600px;
- background: yellow;
- transition: 2s;
- }
- div:hover>*:first-child{
- border: 1px solid green;
- transition: 2s;
- }
- </style>
- </head>
- <body>
- <div>
- <p>asdnk</p>
- <h1>asndjks</h1>
- <ul>
- <li>sdbnjks</li>
- </ul>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement