How do I pan the contents of a div when the right mouse button is dragged?
Posted
by Shaunwithanau
on Stack Overflow
See other posts from Stack Overflow
or by Shaunwithanau
Published on 2010-04-13T14:47:05Z
Indexed on
2010/04/13
15:33 UTC
Read the original article
Hit count: 388
I need a cross browser way of capturing the right mouse click, preventing the default context menu and making it where when the user drags the mouse they can pan the contents of a div. This is largely similar to Google maps in that they will grip the contents and drag to see what they want.
No external libraries please.
I am already capturing the events, and know that this will prevent default actions:
if (evt.preventDefault)
{
evt.preventDefault();
}
else
{
evt.returnValue = false;
}
But this doesn't prevent the context menu AFAIK.
Edit: I really am unsure about how to prevent the context menu and what the best way to manipulate the scroll bars would be? examples would be great
© Stack Overflow or respective owner