Example shows dragging functionality across scrollable DIV containers. If DIV container is bigger then displayed size, approaching element near to the edge will start to auto-scroll. Other dragging examples are placed in Drag and Drop section.
The whole magic lies in changing style position declaration. If position declaration isn’t defined then element has default static style position. So, when DIV elements is clicked with left mouse button nothing will happen until element starts to move. In that moment, script will change style position from static to fixed. This change will take out DIV element from the normal flow of the page and positioned at the desired coordinates (relative to the browser window). Element will stay at that position regardless of scrolling – and that’s desired effect.
Position style has four values: static, relative, absolute, and fixed. Their explanation can be read on very good site http://www.quirksmode.org/css/position.html – it’s definitely recommended to visit.
For the first visitors