julianlam / Scrollable

Mootools class that allows elements with a fixed height be scrollable via mousewheel and via right-hand scrollbar
17 stars 5 forks source link

Variable knob height based on length of content #7

Closed julianlam closed 12 years ago

julianlam commented 12 years ago

Thierry Philippe suggests:

Would it be possible to change knob height according to div content (maybe using getScrollSize and a little formula like: divheight.y / divscroll.y * 100).

afoeder commented 12 years ago

funny; I also wished that. Where I got stuck is the correct formula, because it's not as simple as it looks at the first insight.

We so far need definately a minimum height that doesn't exceed in order to keep the knob "touchable". Then, kind of an exponential ratio is required, it's kind of (scrollheight - visibleheight) / visibleheight or such, but as said: I'm not sure.

Feel free to add comments and thoughts.

afoeder commented 12 years ago

I found this one so far: https://github.com/syntacticx/livepipe-ui/blob/master/src/scrollbar.js#L113 Will experiment if that fits my ideas. :)