5 ms·
I am lazy and (apparently) suck at scrolling smoothly, dropping this in the console worked well :) setInterval(function() { window.scrollTo(0, docume
by addisonj 12y ago
I am lazy and (apparently) suck at scrolling smoothly, dropping this in the console worked well :)
setInterval(function() {
window.scrollTo(0, document.body.scrollTop + 5)
}, 60)
- gtCameron 12y agoThat didn't work in Firefox for me but this one does: setInterval(function () { window.scrollTo(0, document.documentElement.scrollTop + 5); }, 60)
- qwreasdfkjhiouy 12y ago> and math do this instead for 60 intervals per second: setInterval(function() { window.scrollTo(0, document.body.scrollTop + 5) }, 16.666666666666668) or better yet skip the setInterval and have the page continue to move: var scrollIncrement = 5; var height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ) - window.innerHeight; var AnimationFrame = (function() { var FPS = 16.6666666667; // 1000 / 60 = Frames Per Second var RAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(a) { window.setTimeout(a, FPS); } var CAF = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.msCancelAnimationFrame || window.oCancelAnimationFrame || function(a) { window.clearTimeout(a); } return { request: function(a) { RAF(a); }, cancel: function(a) { CAF(a); } } })(); var scroll = function(){ var scrollPosition = Math.max( document.documentElement.scrollTop, document.body.scrollTop ); if ( scrollPosition == height ) scrollIncrement = (-1 * scrollIncrement); else if ( scrollPosition == 0 ) scrollIncrement = (-1 * scrollIncrement); window.scrollBy(0, scrollIncrement); AnimationFrame.request(scroll); } AnimationFrame.request(scroll); you can easily just tweak the scroll distance as well by entering scrollIncrement = x;
- aidenn0 12y agoI held down the "down arrow"
- smackfu 12y agoIn Chrome, that was a bit jumpy compared to using the scroll bar.
- oaktowner 12y agoThanks!
- jholman 12y agoI am lazy and suck at scrolling smoothly, so I middle-click to get the scroll tool set-point, then move my pointer a little below the set-point to indicate that I wish to scroll down slowly. Works in FF and Chrome. Isn't this how everyone scrolls slowly?
- edwintorok 12y agoMiddle-click usually pastes stuff you selected on Linux, so not everyone. However if I enable autoscrolling then middle-click works as you described, quite useful!
- CDokolas 12y agoThis worked like a charm on Firefox! It is also much better when squinting.
- gabriel34 12y agoin IE/Firefox you can click the middle mouse button to get smooth constant scrolling. Chrome probably does this as well
- bradleyland 12y agoSetting the scroll increment to 5px diminishes the lenticular effect; it's like skipping frames in film. Your mind interpolates the result, but it's not as smooth as scrolling by 1px and reducing the time interval to speed things up instead. Try this one instead to see the difference. This will scroll at approximately the same rate as your example: setInterval(function() { window.scrollTo(0, document.body.scrollTop + 1) }, 12); I prefer it a bit slower though: setInterval(function() { window.scrollTo(0, document.body.scrollTop + 1) }, 30);
- acangiano 12y agoNo need to use the console either. Just put bradleyland's suggestion in the address bar prefixed by javascript: javascript:setInterval(function() { window.scrollTo(0, document.body.scrollTop + 1) }, 30);
- geofft 12y agoI'm curious what browser you use. I was under the impression that most of the major browsers had disabled the ability to type javascript: URLs because of self-XSS (which is a fascinating concept on the border between computer exploit and human exploit). On Chrome 39 on CrOS, I can't type that into the URL field, and if I copy/paste it, the "javascript:" portion of the scheme magically disappears, so hitting enter takes me to a SERP. I wonder if that's done in the hope that you Google the self-XSS that you were about to run and see someone explain what's going on.
- gnosek 12y agoThe initial "javascript:" gets stripped on paste but you can add it back manually.