Import of glitchdotcom/glitch-hello-website
This commit is contained in:
@@ -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");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user