Hi.. For my opensourced scrollpane component, I'd like to be able to register when the middle mouse button is clicked and that 4-way compass arrow appears (on windows at least). From there it should be just a little hassle to track the mouse movements so that I can scroll my scrollpane in both left-right and top-down at the same time. But how do you register a click on that middle mouse btn in javascript?
Use jQuery http://api.jquery.com/mousedown/ How ever if you read the above documentation you will find that it is not very reliable.
With jQuery, this will tell you when the "middle click" is pressed, and cancel it. Change as you see fit. $(document).ready(function () { $(window).mousedown(function (e) { if (e.which == '2') { alert('Middle click pressed'); e.preventDefault(); return false; } }); }); Code (markup):