-
-
Save cferdinandi/3fea0c4576e98ea84b1d06faf3a10b86 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Inspecting JavaScript</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style type="text/css"> | |
body { | |
margin: 2em auto; | |
max-width: 40em; | |
width: 88%; | |
} | |
button { | |
transition: transform ease-in 200ms; | |
} | |
</style> | |
</head> | |
<body> | |
<p><button>Activate Me</button></p> | |
<script src="script.js"></script> | |
</body> | |
</html> |
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
// Get the button | |
let btn = document.querySelector('button'); | |
// Do some events | |
btn.addEventListener('click', function () { | |
console.log('Activated'); | |
}); | |
btn.addEventListener('mouseenter', function () { | |
btn.style.transform = 'scale(2)'; | |
}); | |
btn.addEventListener('mouseleave', function () { | |
btn.style.transform = ''; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment