Lightweight (5KB) animated crosshair cursor with smart hover effects and zero setup.
- Zero Markup — style injection and DOM elements are handled automatically.
- Magnetic Hover — automatically snaps and scales to links and buttons.
- Customizable — easy control over colors, sizes, and blend modes.
- Performance — smooth 60fps animation using RequestAnimationFrame.
Just include the script before the closing </body> tag:
<scriptsrc="https://cdn.jsdelivr.net/gh/CodCatDev/CrosshairJs@main/src/crosshair.min.js"></script><script>newCrosshair();</script>You can pass an options object to customize the look and feel:
newCrosshair({style: 'corners',// 'corners' or 'full', preview in demodotSize: 6,// cursor dot sizeoutlineSize: 2,// cursor outline widthoutlineSpace: 30,// space between the dot and the outlinedotColor: '#ff0000',// cursor dot coloroutlineColor: '#fff',// outline coloruseBlend: true,// mix-blend-mode: differencehoverPadding: {x: 15,y: 10}// padding between the cursor and the element when hovering});The cursor automatically tracks all <a>, <button> and elements with the .interactable class. It uses a MutationObserver, so it works perfectly with dynamic content and SPAs.
You can run this in the console:
(function(){consts=document.createElement('script');s.src='https://cdn.jsdelivr.net/gh/CodCatDev/CrosshairJs@main/src/crosshair.js';s.onload=()=>{if(typeofCrosshair!=='undefined'){newCrosshair();console.log('CrosshairJs loaded');}else{console.error('Класс Crosshair не найден');}};document.head.appendChild(s);})();And then add CrosshairJs to any website (until the next page reload =D)
https://codcatdev.github.io/CrosshairJs/
The cursor automatically snaps and scales to links and buttons.
Full-Style:
Corner-Style:


