Created
March 12, 2021 06:07
-
-
Save bogoreh/51934aeba8aba938056990ddb346a239 to your computer and use it in GitHub Desktop.
This file contains 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>Challenge: Spot the Dog</title> | |
<style> | |
.dot { | |
border-radius: 10px; | |
background: purple; | |
position: absolute; | |
width: 10px; | |
height: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<div> | |
<img id="dog-pic" src="https://upload.wikimedia.org/wikipedia/commons/a/aa/Alopekis_white_male.jpg" width="500" alt="White dog"> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
<script> | |
$("#dog-pic").on("click", function(event) { | |
var $dot = $("<div></div>"); | |
$dot.addClass("dot"); | |
$dot.appendTo("body"); | |
$dot.css("top", event.pageY + "px"); | |
console.log(event); | |
$dot.css("left", event.pageX + "px") | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment