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


Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…


HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….


CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…


How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…


Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *