Skip to content

Instantly share code, notes, and snippets.

@dorukcan
Last active April 7, 2019 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorukcan/72aa852e2af576ddd4cfe84428af2e8b to your computer and use it in GitHub Desktop.
Save dorukcan/72aa852e2af576ddd4cfe84428af2e8b to your computer and use it in GitHub Desktop.
var horizontal_line = document.createElement('div');
horizontal_line.setAttribute('style', `
position: absolute;
left: 0px;
top: 0;
width: 1px;
height: 100%;
background-color: red;
z-index: 999999;
`);
document.body.appendChild(horizontal_line);
document.addEventListener("mousemove", function(e) {
horizontal_line.style.left = (e.clientX - 1) + 'px';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment