custom scrollbar scroll panel - Free Download Create Scrollable Container With Custom Scrollbar - scrollPanel

Free Download Create Scrollable Container With Custom Scrollbar – scrollPanel

Posted on

This time I will share jQuery Plugin and tutorial about Create Scrollable Container With Custom Scrollbar – scrollPanel, hope it will help you in programming stack.

custom scrollbar scroll panel - Free Download Create Scrollable Container With Custom Scrollbar - scrollPanel
File Size: 68.9 KB
Views Total: 2731
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

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.

2         integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
3         crossorigin="anonymous">
4 </script>
5 <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.

3. Attach the function to the target container.

1 <div class="scrollpanel">
2   Any content here
3 </div>
1 $(".scrollpanel").scrollpanel();

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

01 <div class="scrollpanel">
02  
03   <div class="sp-viewport">
04     <div class="sp-container">
05       Any content here
06     </div>
07   </div>
08  
09   <div class="sp-scrollbar">
10     <div class="sp-thumb"></div>
11   </div>
12    
13 </div>

5. Customize the scrollbar in the CSS:

01 .scrollpanel .sp-scrollbar {
02   width: 10px;
03   background-color: #ccc;
04   cursor: pointer;
05 }
06  
07 .scrollpanel .sp-scrollbar .sp-thumb {
08   background-color: #aaa;
09   transition: height 0.2s ease-in-out;
10 }
11  
12 .scrollpanel .sp-scrollbar.active .sp-thumb {
13   background-color: #999;
14 }

6. Customize the CSS prefix.

1 $(".scrollpanel").scrollpanel({
2   prefix: 'sp-'
3 });

Changelog:

2020-07-28

2019-04-15

  • 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.