HTML でカスタム スクロール バーをコーディングしようとしています。
何かのようなもの
<div class="demo">
<div class="content">
My content comes here
</div>
<div class="scrollbar">
<div class="thumb"></div>
</div>
</div>
jqueryで親指の高さを動的に設定しようとしています。
しかし、親指のサイズの公式がわかりません。
のようなことを試しました
$.scrollViewHeight = $('.demo').height();
$.contentHeight = $('.content').height();
$.thumbHeight = ($.scrollViewHeight / $.contentHeight) * $.scrollViewHeight;
$('.thumb').height($.thumbHeight);
しかし、うまくいきません。
Q1. 親指の高さを求める公式は?
50px
また、cssを使用して最小親指サイズを維持しました。
Q2. では、この場合、コンテンツがはるかに多くなるため、親指の速度をどのように計算するのでしょうか。
.