Created
December 18, 2025 18:14
-
-
Save tln/8add04f405173f7d5e64ca0693b9d1e8 to your computer and use it in GitHub Desktop.
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
| (function() { | |
| const existingH = document.getElementById('crosshair-h'); | |
| const existingV = document.getElementById('crosshair-v'); | |
| // Toggle: If they exist, remove them and stop | |
| if (existingH) { | |
| existingH.remove(); | |
| existingV.remove(); | |
| return; | |
| } | |
| const style = 'position: fixed; background: rgba(255, 0, 0, 0.5); pointer-events: none; z-index: 999999;'; | |
| const hLine = document.createElement('div'); | |
| const vLine = document.createElement('div'); | |
| hLine.id = 'crosshair-h'; | |
| vLine.id = 'crosshair-v'; | |
| hLine.style.cssText = style + 'height: 1px; width: 100%; left: 0;'; | |
| vLine.style.cssText = style + 'width: 1px; height: 100%; top: 0;'; | |
| document.body.appendChild(hLine); | |
| document.body.appendChild(vLine); | |
| window.addEventListener('mousemove', (e) => { | |
| hLine.style.top = e.clientY + 'px'; | |
| vLine.style.left = e.clientX + 'px'; | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment