Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>JS Custom Cursor</title>
- <style>
- .cursor {
- box-shadow: 0 0 15px #00000033;
- transform: translate(-50% -50%);
- border: 1px solid #0000001a;
- backdrop-filter: blur(3px);
- background: #ffffff0d;
- position: absolute;
- border-radius: 50%;
- aspect-ratio: 1;
- z-index: 9;
- width: 60px;
- }
- </style>
- </head>
- <body>
- <h2>JS Custom Cursor</h2>
- <div class="cursor"></div>
- <script>
- const cursor = document.querySelector('.cursor');
- const animateCursor = (e) => {
- cursor.style.left = `${e.pageX}px`;
- cursor.style.top = `${e.pageY}px`;
- }
- window.addEventListener('mousemove', animateCursor);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement