Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- html, body {
- border: 0;
- margin: 0;
- } .axis {
- position: absolute;
- background-color: #000000;
- top: -1px;
- left: -1px;
- z-index: -1;
- } #x {
- width: 100%;
- height: 1px;
- left: 0px;
- } #y {
- width: 1px;
- height: 100%;
- top: 0px;
- }
- </style>
- <body>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- <h1>Content</h1>
- <h2>Content</h2>
- <h3>Content</h3>
- <h4>Content</h4>
- <h5>Content</h5>
- <h6>Content</h6>
- </body>
- <script>
- var x = document.createElement("div"),
- y = x.cloneNode(false);
- x.className = y.className = "axis";
- x.id = "x"; y.id = "y";
- x.appendChild(document.createTextNode(" "));
- document.body.appendChild(x);
- document.body.appendChild(y);
- ("onmousemove" in this?this:document.body).onmousemove = function(e) {
- e = e || event;
- x.style.top = e.clientY + document.body.scrollTop + document.documentElement.scrollTop + "px";
- y.style.left = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft + "px";
- }; ("onscroll" in this?this:document.body).onscroll = function(e) {
- x.style.left = document.body.scrollLeft + document.documentElement.scrollLeft + "px";
- y.style.top = document.body.scrollTop + document.documentElement.scrollTop + "px";
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement