-
-
Save zhang-ning/98f44033940cc0481af3 to your computer and use it in GitHub Desktop.
Minimap of a web page
This file contains hidden or 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
javascript: | |
var minimap = document.body.cloneNode(true); | |
[].forEach.call(minimap.getElementsByTagName('a'), function(link) { | |
link.href = 'javascript:;'; | |
}); | |
minimap.style.position = 'fixed'; | |
minimap.style.webkitTransform = 'scale(.1)'; | |
document.body.appendChild(minimap); | |
minimap.style.top = minimap.offsetHeight*-.45+'px'; | |
minimap.style.right = minimap.offsetWidth*-.45+'px'; | |
minimap.onmousedown = function(e) { | |
document.body.scrollTop = 10*e.clientY-innerHeight/2; | |
document.onmousemove = arguments.callee; | |
document.onmouseup = function(){ document.onmousemove = null; }; | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment