Import of glitchdotcom/glitch-hello-website

This commit is contained in:
Glitch (glitch-hello-website)
2021-06-28 13:43:15 +00:00
parent ae651900b2
commit 6d8273792c
4 changed files with 30 additions and 21 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
/*
This is your site JavaScript code - you can add interactivity and carry out processing
- Initially the JS writes a message to the console, and rotates a button you can add from the README
- Initially the JS writes a message to the console, and moves a button you can add from the README
*/
// Print a message in the browser's dev tools console each time the page loads
@@ -8,15 +8,15 @@ This is your site JavaScript code - you can add interactivity and carry out proc
console.log("Hello 🌎");
/*
Make the "Click me!" button rotate when the visitor clicks it:
Make the "Click me!" button move when the visitor clicks it:
- First add the button to the page by following the "Next steps" in the README
*/
const btn = document.querySelector("button"); // Get the button from the page
// Detect clicks on the button
if (btn) {
btn.onclick = function() {
// The JS works in conjunction with the 'rotated' code in style.css
btn.classList.toggle("rotated");
// The JS works in conjunction with the 'dipped' code in style.css
btn.classList.toggle("dipped");
};
}