Skip to content

Instantly share code, notes, and snippets.

@bradmontgomery
Created February 10, 2012 05:47
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradmontgomery/1787016 to your computer and use it in GitHub Desktop.
Save bradmontgomery/1787016 to your computer and use it in GitHub Desktop.
bookmarklet to highlight one line of text based on the position of your mouse
javascript:(function (){h=document.createElement("div");h.setAttribute("id","_bradshiliteline");h.setAttribute("style","width:100%;height:20px;background-color:yellow;font-size:inherit;line-height:inherit;position:absolute;left:0px;top:0px;z-index:999;opacity:0.4;");document.getElementsByTagName("body")[0].appendChild(h);window.onmousemove=function(e){var h=document.getElementById("_bradshiliteline");h.style.top=(e.pageY+15)+"px";h.setAttribute("class",e.pageY);}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment