Minimalistic Custom Slider Scrollbar Plugin | Perfect slider

Slider Perfect is a simple but perfect (for us, and probably most developers) slider plugin that allows you to beautify virtual sliders without changing or adding any style to the original elements.

Why perfect scrolling?

Perfect Slider is a simple yet perfect plugin.

  • No change in design layout
  • Do not tamper with the DOM tree
  • Use normal scrollTop and scrollLeft
  • Slider style is fully customizable
  • Effective update to change the layout

We hope you love it!

perfect scrollbar horizontal scroll, perfect scrollbar, ngx perfect scrollbar, javascript scrollbar plugin, jquery scrollbar, perfect scrollbar bootstrap, perfect scrollbar scroll to element

Before using the perfect slider

The following requirements must be met.

  • The container must have a position style.
  • The container must be a normal container element.

The following requirements are included in basic CSS, but please keep in mind when you want to change your CSS files.

  • The container must have an override style: css hidden.
  • The position of the slider must be absolute.
  • Slider-x should be bottom or top, and slider-y should be right or left.

Finally, scroll binding is generally a bad practice, and an ideal scrollbar should be used with care. Unless there is an actual need for custom scrolling, it is always recommended to use the browser’s native scrolling.

How to make use of it:

1. Include the perfect-scrollbar’s CSS file within the doc.

<link href="min/perfect-scrollbar.min.css" rel="stylesheet">

2. The HTML structure.

<div id="demo"><br>  <div class="content"> </div><br></div>

3. Include the mandatory javascript file on the backside of the web page.

<script src="min/perfect-scrollbar.min.js"></script> 

4. Call the plugin on the highest container and executed it.

new PerfectScrollbar('#demo', {
    // options here

5. Options and defaults.

new PerfectScrollbar('#demo', {

    // A list of handlers to scroll the element.
    handlers: ['click-rail', 'drag-thumb', 'keyboard', 'wheel', 'touch'],

    // This sets threshold for ps--scrolling-x and ps--scrolling-y classes to remain. In the default CSS, they make scrollbars shown regardless of hover state. The unit is millisecond.
    scrollingThreshold: 1000,

    // The scroll speed applied to mousewheel event.
    wheelSpeed: 1,

    // If true, when the scroll reaches the end of the side, 
    // mousewheel event will be propagated to parent element.
    wheelPropagation: false, 

    // When set to an integer value, the thumb part of the scrollbar
    // will not shrink below that number of pixels.
    minScrollbarLength: null,

    // When set to an integer value, the thumb part of the scrollbar 
    // will not expand over that number of pixels.
    maxScrollbarLength: null, 

    // When set to true, and only one (vertical or horizontal) scrollbar
    // is visible then both vertical and horizontal scrolling will affect the scrollbar.
    useBothWheelAxes: false, 

    // When set to true, the scroll bar in X axis will not be available, 
    // regardless of the content width.
    suppressScrollX: false, 

    // When set to true, the scroll bar in Y axis will not be available, 
    // regardless of the content height.
    suppressScrollY: false, 

    // true: swipe scrolling will be eased
    swipeEasing: true,

    // The number of pixels the content width can surpass the 
    // container width without enabling the X axis scroll bar. 
    scrollXMarginOffset: 0, 

    // The number of pixels the content height can surpass the 
    // container height without enabling the Y axis scroll bar. 
    scrollYMarginOffset: 0


6. Event handlers.

// fired when the x-axis is scrolled in either direction
container.addEventListener('ps-scroll-x', () => ...);

// fired when the y-axis is scrolled in either direction
container.addEventListener('ps-scroll-y', () => ...);

// fired when scrolling upwards
container.addEventListener('ps-scroll-up', () => ...);

// fired when scrolling downward
container.addEventListener('ps-scroll-down', () => ...);

// fired when scrolling to the left
container.addEventListener('ps-scroll-left', () => ...);

// fired when scrolling to the right
container.addEventListener('ps-scroll-right', () => ...);

// fired when scrolling reaches the start of the x-axis.
container.addEventListener('ps-x-reach-start', () => ...);

// fired when scrolling reaches the end of the x-axis
container.addEventListener('ps-x-reach-end', () => ...);

// fired when scrolling reaches the start of the y-axis.
container.addEventListener('ps-y-reach-start', () => ...);

// fired when scrolling reaches the end of the y-axis (useful for infinite scroll)
container.addEventListener('ps-y-reach-end', () => ...);

Tiny JavaScript Plugin For Beautifying Scrollbar, perfect-scrollbar Plugin/Github, custom scrollbar js

See Demo And Download

Official Website(mdbootstrap): Click Here

This superior jQuery/javascript plugin is developed by mdbootstrap. For extra Advanced Usages, please go to the official website.

Related Posts


Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…


Simple jQuery Cookie Consent Plugin

jquery.cookie-consent is a simple jQuery plugin to request consent to use cookies. An easy-to-use and highly customizable cookie consent bar that informs your visitors of the use…


Timepicker JavaScript Plugin for jQuery Inspired by Google Calendar

jquery.timepicker is a lightweight jQuery timer plugin inspired by Google Calendar. It supports both mouse and keyboard navigation and weighs 5.5KB minified and compact. Features: Highly customizable…


A Lightweight, Touchable, and Responsive Angular Universal Carousel Library

ngxCarousel is a lightweight, tactile, and responsive library for creating an angular carousel. No dependencies, no more hammer. Must Read: Angular Responsive Image Slider With Lightbox Popup…


Generate a Random Number Picker In Vanilla JavaScript

Random Number Picker is a Vanilla JS-based number picker that allows you to generate a random number within a specified range. Must Read: Generating Lottery Numbers Using…


Nepali Date Picker jQuery Plugin | nepaliDatePicker

Nepali Date Picker is a customizable, easy-to-use, and input-based date picker plugin mostly based on the Nepali calendar. Users can choose a Nepali date in the navigable…