Skip to content

Instantly share code, notes, and snippets.

@liamnewmarch
Created September 25, 2018 11:30
Show Gist options
  • Save liamnewmarch/2e7b5b4130a75f1667fdeb22a43008e7 to your computer and use it in GitHub Desktop.
Save liamnewmarch/2e7b5b4130a75f1667fdeb22a43008e7 to your computer and use it in GitHub Desktop.
Bookmarklet for quickly adding crosshairs to a page for visually checking alignment
// 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