what is the Formula for custom scroll bar thumb size

chicanapride

New Member
I am trying to code a custom scroll bar in HTML.
Something like\[code\]<div class="demo"> <div class="content"> My content comes here </div> <div class="scrollbar"> <div class="thumb"></div> </div></div>\[/code\]I am trying to set height of the thumb dynamically with jquery.But, unable to figure out the formula for the thumb size.
tried some thing like\[code\]$.scrollViewHeight = $('.demo').height();$.contentHeight = $('.content').height();$.thumbHeight = ($.scrollViewHeight / $.contentHeight) * $.scrollViewHeight;$('.thumb').height($.thumbHeight);\[/code\]but it doesn't work.
Q1. What could be the formula to get the height of the thumb?also i kept min-thumb size as \[code\]50px\[/code\] using css.
Q2. So, how do we calculate the speed of thumb in this case as content will be much more..
 
Back
Top