Fix for #NewTwitter: Scrolling the Details Pane
I am getting more and more used to #NewTwitter and generally like the new features. Particularly the details pane, which provides quick preview of images, videos, etc. is really very useful. However, there is something related to it that annoys me much - if you scroll it with the mouse wheel (which is definitely the case with the majority of users) once you reach the top or bottom and continue scrolling (e.g. by accident, which happens to me very often), the whole page begins scrolling and you can easily lose sight of the tweet on the left to which the pane is related. So I am now sharing a simple fix and if you like it, please help to let the guys at Twitter know about it.
Update: Twitter have changed their design so this post covers a previous issue on their website and is no longer relevant.
First, a very quick demo of what I mean:
And the JavaScript/jQuery snippet which fixes the issue:
$('#page-container div.pane-components').live('mousewheel DOMMouseScroll', function(e) { var scrollTop = this.scrollTop, clientHeight = this.clientHeight, scrollHeight = this.scrollHeight, originalEvent = e.originalEvent, scrollingUp = (originalEvent.wheelDelta || -originalEvent.detail) > 0; if (scrollingUp && scrollTop == 0 || !scrollingUp && scrollTop + clientHeight == scrollHeight) e.preventDefault(); })
It just checks if the top or bottom of the details pane has been reached and when it has, the default action the mouse wheel event triggers (i.e. scrolling the whole page) is prevented.
If you would like to test the fix on your own, just load some Twitter page in your browser, then copy/paste the following code in your browser address bar and hit the "Enter" key:
javascript:$('#page-container div.pane-components').live('mousewheel DOMMouseScroll', function(e) { var scrollTop = this.scrollTop, clientHeight = this.clientHeight, scrollHeight = this.scrollHeight, originalEvent = e.originalEvent, scrollingUp = (originalEvent.wheelDelta || -originalEvent.detail) > 0; if (scrollingUp && scrollTop == 0 || !scrollingUp && scrollTop + clientHeight == scrollHeight) e.preventDefault(); });void(0)
And for a permanent fix, until eventually Twitter fixes the issue, you can install the following user script in your browser (Opera, Chrome, Firefox via Greasemonkey or Safari via GreaseKit):
https://github.com/vadikom/twitter-scroll-fix/raw/master/twitter-scroll-fix.user.js
Spread the Word
If you find this fix useful, tweet about it so that it can reach the guys at Twitter and they consider using it or a similar solution.
Well, that's all I can do about it.