View Single Post
04-23-2010, 05:57 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

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.

Reply With Quote