Cara Custom Scrollbar Menggunakan CSS
Tutorial Memberikan Style Pada Scrollbar Blogger, cara ini bisa untuk Mempercantik Tampilan Template Blogspot dan tentunya tidak akan memberatkan loading blog karena CSS ::-webkit-scrollbar ini cukup simpel.
Bagian-bagian Dari CSS webkit scrollbar
Kalian bisa mencustomize semua bagian scrollbar dengan menggunakan css webkit dibawah ini
::-webkit-scrollbar { /* 1 */ }
::-webkit-scrollbar-button { /* 2 */ }
::-webkit-scrollbar-track { /* 3 */ }
::-webkit-scrollbar-track-piece { /* 4 */ }
::-webkit-scrollbar-thumb { /* 5 */ }
::-webkit-scrollbar-corner { /* 6 */ }
::-webkit-resizer { /* 7 */ }
juga bisa menentukan bagian tertentu dan dari kondisi apa scrollbar akan diberi style, dengan menggabungkan css selector berikut
:horizontal
:vertical
:decrement
:increment
:start
:end
:double-button
:single-button
:no-button
:corner-present
:window-inactive
Source : webkit.org/blog/363/styling-scrollbars
:horizontal
The horizontal pseudo-class applies to any scrollbar pieces that have a horizontal orientation.
:vertical
The vertical pseudo-class applies to any scrollbar pieces that have a vertical orientation.
:decrement
The decrement pseudo-class applies to buttons and track pieces. It indicates whether or not the button or track piece will decrement the view’s position when used (e.g., up on a vertical scrollbar, left on a horizontal scrollbar).
:increment
The increment pseudo-class applies to buttons and track pieces. It indicates whether or not a button or track piece will increment the view’s position when used (e.g., down on a vertical scrollbar, right on a horizontal scrollbar).
:start
The start pseudo-class applies to buttons and track pieces. It indicates whether the object is placed before the thumb.
:end
The end pseudo-class applies to buttons and track pieces. It indicates whether the object is placed after the thumb.
:double-button
The double-button pseudo-class applies to buttons and track pieces. It is used to detect whether a button is part of a pair of buttons that are together at the same end of a scrollbar. For track pieces it indicates whether the track piece abuts a pair of buttons.
:single-button
The single-button pseudo-class applies to buttons and track pieces. It is used to detect whether a button is by itself at the end of a scrollbar. For track pieces it indicates whether the track piece abuts a singleton button.
:no-button
Applies to track pieces and indicates whether or not the track piece runs to the edge of the scrollbar, i.e., there is no button at that end of the track.
:corner-present
Applies to all scrollbar pieces and indicates whether or not a scrollbar corner is present.
:window-inactive
Applies to all scrollbar pieces and indicates whether or not the window containing the scrollbar is currently active. (In recent nightlies, this pseudo-class now applies to ::selection as well. We plan to extend it to work with any content and to propose it as a new standard pseudo-class.)
Cara Pemasangan Webkit Custom Scrollbar di Blog
- Masuk ke Edit HTML
- Lalu masukan CSS Custom Scrollbar berikut diatas tag
</head>
- Save dan lihat hasilnya
<style>
/*INDOASIAP.blogspot.com*/
::-webkit-scrollbar {
width: 1em;
z-index: 100;
background-color: #bbbbbb;
}
::-webkit-scrollbar-thumb {
background-color: #fe6b8b;
box-shadow: 0 -100vh 0 100vh #fe6b8b;
}
</stle>
Jika kurang puas dengan style diatas, kalian bisa mengkreasikan dengan menambahkan CSS lain atau menggabungkan kedua selector diatas contoh
<style>
::-webkit-scrollbar-track-piece:start {
/* Select the top half (or left half) or scrollbar track individually */
}
::-webkit-scrollbar-thumb:window-inactive {
/* Select the thumb when the browser window isn't in focus */
}
::-webkit-scrollbar-button:horizontal:decrement:hover {
/* Select the down or left scroll button when it's being hovered by the mouse */
}
</style>
Demo Custom Scrollbar