View Full Version : Disabling Grab Scroll Script on Forms

02-23-2012, 05:18 AM
I've got this script working for grabbing and scrolling a website (http://www.javascriptsource.com/page-details/grab-and-scroll-page.html), and it's perfect; the only problem is I'd like to disable it when clicking a form (basically, not being able to drag scroll when clicking inside a form or input tag). This could be either by specifying a class or ID, whatever works best.

This is the script, in case the website goes down or something:

<script type="text/javascript">

document.onmousedown = function(){
var e=arguments[0]||event;
var x=document.body.scrollLeft+e.clientX;
var y=document.body.scrollTop+e.clientY;
scrollTo(x-e.clientX, y-e.clientY);
return false;
return false;

Also, would there be a way to enable grab scrolling just on the background? I mean, disabling it on images, text and any other element, and just leaving the empty spaces of the website with the ability to scroll.

Thanks a bunch in advance.