Create Scrollable Container With Custom Scrollbar - scrollPanel

File Size: 68.9 KB
Views Total: 4707
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Create Scrollable Container With Custom Scrollbar - scrollPanel

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

How to use it:

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-'




  • v1.1.0: update

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