Created
September 23, 2019 14:18
-
-
Save codebubb/f2373bd02ca74a749bd23699ce5961f2 to your computer and use it in GitHub Desktop.
Hover with JavaScript
This file contains hidden or 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"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Hover with JavaScript</title> | |
| <style> | |
| #hoverlink { | |
| padding: 5px; | |
| text-decoration: none; | |
| background-color: rgb(199, 82, 82); | |
| color: #fff; | |
| box-shadow: 0px 0px 2px 2px rgba(0,0,0,0.1); | |
| font-family:Arial, Helvetica, sans-serif; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <a id="hoverlink" href="#">Hover test</a> | |
| <script> | |
| hoverlink.addEventListener('mouseenter', (e) => { | |
| console.log('Mouse enter'); | |
| }); | |
| hoverlink.addEventListener('mouseleave', (e) => { | |
| console.log('Mouse leave'); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment