Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mouse Follow Shape</title>
    
</head>
<body>
    <div class="shape"></div>
    <script>
        document.addEventListener('mousemove', function(event) {
            const x = event.clientX;
            const y = event.clientY;
            
            const shape = document.querySelector('.shape');
            shape.style.left = `${x}px`;
            shape.style.top = `${y}px`;
        });
    </script>
</body>
</html>
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers