Created
March 11, 2021 12:22
-
-
Save bogoreh/58f572d8da25dec5b2e2ebe9bc941526 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Spin-off of "Challenge: Cat-stache"</title> | |
| <style> | |
| #mustache-pic { | |
| position: absolute; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <img id="cat-pic" src="https://www.kasandbox.org/programming-images/animals/cat.png" width="300" alt="cat photo"> | |
| <img id="mustache-pic" src="https://www.kasandbox.org/programming-images/misc/mustache.png" alt="mustache" width="100"> | |
| <script> | |
| var catPic = document.getElementById("cat-pic"); | |
| var onCatClick = function(e) { | |
| var stashePic = document.getElementById("mustache-pic"); | |
| stashePic.style.top = e.clientY+"px"; | |
| stashePic.style.left = e.clientX+"px"; | |
| }; | |
| catPic.addEventListener("click", onCatClick); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment