A Pen by Camille Frantz on CodePen.
Created
March 14, 2022 08:50
-
-
Save fyrfli/1e0e3fba1445eada8e7541af8c061d37 to your computer and use it in GitHub Desktop.
My first JS code
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
<h1 class="head">Place holder here ... stay tuned!</h1> | |
<button id="init">Hit me where it tickles!</button> |
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
let initButton = document.getElementById("init"); | |
initButton.onclick = function changeHDG() { | |
let message = document.querySelector("h1"); | |
let name = undefined; | |
name = prompt("What is your name?", []); | |
message.textContent = | |
name != undefined && name != "" | |
? "Hello there, " + name + "!" | |
: "Well, hello anyway!"; | |
}; |
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
body { | |
text-align: center; | |
margin: 80px auto; | |
} | |
#init { | |
background: violet; | |
text-align: center; | |
font-size: 14px; | |
padding: 10px 20px; | |
border-radius: 20px; | |
border: none; | |
box-shadow: 2px 2px 10px grey; | |
cursor: click; | |
transition: transform 0.8s 0.01s; | |
} | |
#init:active, | |
#init:hover { | |
transform: scale(110%); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment