My goal is to create a scroll bar using two divs with heights of 110px and 10px. The smaller one will be nested inside the taller one, allowing for adjustment of its margin-height from 0 to 100px while still fitting within the larger div.
When I refer to fitting on a scale from 1 to 100 in the title, I am talking about setting the height of the smaller div.
Now, I am trying to determine how to calculate the ratio to position my 10px div relative to the taller div based on the document's height ratio to the window's height.
I have been experimenting all night without success. Below is some code I have used, although I am removing it to focus solely on new ideas. Your advice is appreciated.
var wheight = $(window).height();
var dheight = $(document).height();
document.getElementById("wheight").innerHTML=wheight;
document.getElementById("dheight").innerHTML=dheight;
document.getElementById("sidescrollbtn").style.marginTop = '70px';