私のソリューションでは、CSSを使用してWebkitのスクロールバーを変更しています。はじめにCSSトリックを参照
してください
。
考慮すべき点がいくつかあります。
最初に:position: absolute;
javascriptでスクロールを使用する場合-likewindow.scrollTo
はもう機能しません。
2番目:のbackground-color
属性scrollbar-track
は必須です。省略した場合(絶対位置を使用しない場合)、スクロールバーの再描画機能は機能しなくなります。これはWebkitのバグのようです。
body {
/* hide the horizontal scrollbar */
overflow-x: hidden;
}
/* make the scrollbar a little wider */
::-webkit-scrollbar {
width: 16px;
}
::-webkit-scrollbar-track {
background-color: white;
}
/* the slider or "thumb" has some rounded edges and a shadow and it's a little translucent */
::-webkit-scrollbar-thumb {
border-radius: 6px;
box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
background: rgba(159,216,239,0.8);
}
/* I don't like the scrollbar to be so tiny on large documents - hence I set a minimum height */
::-webkit-scrollbar-thumb:vertical {
min-height: 100px;
}
/* Use a more translucent slider when the window is inactive */
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(159,216,239,0.2);
}
<style>
スクロールバーで使用されるHTMLのコンテンツのタグでこのCSSを使用するとWebEngine
、新しい光沢のある光沢のある青と幅の広いスクロールバーになります。これにより、Win7/XPでのスクロールバーの「ホッピング」の問題も解決されます。
水平スクロールバーも変更するには、の高さ属性をwebkit-scrollbar
指定する必要があり、のmin-width
属性を...-scrollbar-thumb:vertical
一緒に指定できます。