Created
September 25, 2018 11:30
-
-
Save liamnewmarch/2e7b5b4130a75f1667fdeb22a43008e7 to your computer and use it in GitHub Desktop.
Bookmarklet for quickly adding crosshairs to a page for visually checking alignment
This file contains 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
// 1. Create a new bookmark – usually by right-clicking the bookmark toolbar. | |
// 2. Name it (e.g. ‘crosshair’) and paste the following line in the URL field: | |
javascript:((d,p)=>{c=d.body.appendChild(d.createElement('canvas')),a=c.getContext('2d'),d.onmousemove=(e)=>{c.width=w=innerWidth;c.height=h=innerHeight;with(c.style)position='absolute',top=left=0,width=w+p,height=h+p,pointerEvents='none';with(a)clearRect(0,0,w,h),fillStyle='#0002',fillRect(0,e.pageY,w,1),fillRect(e.pageX,0,1,h)}})(document, 'px') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment