Skip to content

Instantly share code, notes, and snippets.

@ioseb
Created July 1, 2009 07:36
Show Gist options
  • Save ioseb/138653 to your computer and use it in GitHub Desktop.
Save ioseb/138653 to your computer and use it in GitHub Desktop.
$(function() {
var curpos = 0,
moving = false;
function empty() { return false; };
$('#scroll').mousedown(function(e) {
curpos = e.pageY
moving = true;
$(this).bind('selectstart', empty);
$(this).bind('drag', empty);
}).mousemove(function(e) {
if (moving) {
this.scrollTop = this.scrollTop + (e.pageY - curpos);
}
}).mouseup(function(e) {
moving = false;
$(this).unbind('selectstart', empty);
$(this).unbind('drag', empty);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment