Sure, there are properties belonging to the window and the div that you can take a look at, do a little math and change to the correct values. Things to look into would be element.scrollTop (and …scrollLeft ) to manipulate the scrollbars, element.offsetTop (and …offsetLeft ) to help with finding the top-left corner of your div , element.offsetWidth (and offsetHeight ).
Also if you have the luxury of working with a JavaScript framework (like jQuery, Prototype, YUI, etc.) then things like this are usually wrapped up in helper functions to make life easier.
|