Basic example
Scrollbar is initialized automatically when you add data-twe-perfect-scrollbar-init
attribute to your container.

Options
JavaScript init
You can easily init scrollbar with JavaScript. You have to invoke PerfectScrollbar()
or twe.PerfectScrollbar()
if you are using UMD format and include options within that.

Data attributes
You can easily init scrollbar with options with data-twe-attributes
. You have to add data-twe-perfect-scrollbar-init
to your wrapper. If you want add options with data-twe-attr you have to add for example data-twe-suppress-scroll-x="true"
to your container.

Colors example
Scrollbar's thumb and rail's colors can be customized by changing the default classes we add to them. Change the classes of the Scrollbar element that you would like to edit: railXColors
, railXThumbColors
, railYColors
or railYThumbColors
. Visit the API section to see the default classes for those elements.

Events
PerfectScrollbar dispatches custom events.
- ScrollX
- ScrollY
- ScrollUp
- ScrollDown
- ScrollLeft
- ScrollRight
- ScrollXEnd
- ScrollYEnd
- ScrollXStart
- ScrollYStart
Example
