Create Scrollable Container With Custom Scrollbar - scrollPanel

Create Scrollable Container With Custom Scrollbar - scrollPanel

scrollPanel is a jQuery plugin that transforms a DIV container into a scrollable panel where you can customize the scrollbar using your own CSS rules.

1. Download and import the jquery-scrollpanel.js script after jQuery.

<script src="" 
<script src="dist/jquery-scrollpanel.js"></script>

2. To enable the mousewheel on the scrllable panel, import the latest jQuery mouse wheel plugin in the document.

<script src=""></script>

3. Attach the function to the target container.

<div class="scrollpanel">
  Any content here

4. This will transform the DIV container into a scrollable panel:

<div class="scrollpanel">
  <div class="sp-viewport">
    <div class="sp-container">
      Any content here
  <div class="sp-scrollbar">
    <div class="sp-thumb"></div>

5. Customize the scrollbar in the CSS:

.scrollpanel .sp-scrollbar {
  width: 10px;
  background-color: #ccc;
  cursor: pointer;
.scrollpanel .sp-scrollbar .sp-thumb {
  background-color: #aaa;
  transition: height 0.2s ease-in-out;
.scrollpanel .sp-thumb {
  background-color: #999;

6. Customize the CSS prefix.

  prefix: 'sp-'

This awesome jQuery plugin is developed by lrsjng. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 06.04.2019
  • Source