View Full Version : DIV Scroll ???

07-12-2003, 07:19 AM
All i want to know is if we have control over the onscroll event.I know that one can call a event handler on the div onscroll event.But what i want to know here is if i am scrolling upwards or down on the DIV.How could i know the same ?

I want to know how one can control the scroll of a div
Suppose i have a div of a fixed height.I construct a table and write the same into the DIV (div.innerHTML).Now i see a vertical scroll bar
I want to add or remove rows to the table on the onscroll event
When i sroll down i want to add rows and at the same time when i scroll up i want to reomve rows .Is this possible.

Any help would be appreciated

07-15-2003, 05:59 PM
I have been using a style class to control scrolling in DIVS that looks like these:
.ColmScroll {overflow:auto;width:100%;height:100%;}
.ColmScroll95 {overflow:auto;width:100%;height:95%;}
.ColmScroll98 {overflow:auto;width:100%;height:98%;}

In the frames columns, there is usually a div above the scrolling div, that I have a fixed position on, like this:

.Caption {Display:Block;Width:100%;
Position:fixed; Top:0px;Bottom:Auto;

This permits the lower div to scroll under the upper div, without the upper div moving.

The different height adjustments are needed, as at 100%, the bottom of the scroll doesn't always show up. You have to adjust the height per usage, which seems to be effected by the size of the Caption Div, although 95% seems to work well consistenly.

This design also compensates for different resolutions and window sizes. I used Class, so I could also input other designs in as an ID.

<Div Class=ColmScroll95 ID=Colorscheme>