JSFiddle - React, Tailwind, and code Playground
by dandenney
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Custom Scrollbars - a jQuery Plugin</title>
</head>
<body>
<ul class="fff months category">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
<li>20</li>
<li>21</li>
<li>22</li>
<li>23</li>
<li>24</li>
<li>25</li>
<li>26</li>
<li>27</li>
<li>28</li>
<li>29</li>
<li>30</li>
<li>31</li>
</ul>
<ul class="fff months subcategory">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
<li>20</li>
<li>21</li>
<li>22</li>
<li>23</li>
<li>24</li>
<li>25</li>
<li>26</li>
<li>27</li>
<li>28</li>
<li>29</li>
<li>30</li>
<li>31</li>
</ul>
</body>
</html>
CSS
html, body{background:#EEE;color:#111;font:13px Helvetica,sans-serif;}
body{margin:0 auto;width:1200px;}
.css-scrollbar{width:250px;height:300px;margin:100px 25px;-moz-box-shadow:0px 0px 12px 3px #CCC;overflow:hidden;float:left;background:#FFF;border:1px solid #B2B2B2;}
.css-scrollbar.simple{width:250px;height:400px;margin:100px 25px;overflow:hidden;float:left;background:#EEE;-moz-box-shadow:none;border:none;}
.css-scrollbar p{margin:0;padding:8px;line-height:1.4;}
ul.months {
display: block;
overflow: auto;
width: 51px;
background: #FFF;
border: 1px solid #B2B2B2;
list-style: none;
margin: 100px 30px;
max-height: 220px;
overflow-x: hidden;
overflow-y: auto;
padding: 2px 0;
float: left;
}
ul.months li {
color: #111;
cursor: pointer;
font-size: 93%;
padding: 1px 5px;
text-align: left;
white-space: nowrap;
}
ul.subcategory {
display: none;
}
/* ---------- basic theme: these are the most necessary styles --------------------------------- */
.scrollbar-pane {
margin-right: 20px;
}
.scrollbar-handle-container {
background: #EEE;
width: 20px;
}
.scrollbar-handle {
width: 20px;
background: #999;
}
.scrollbar-handle:hover {
background: #666;
}
.scrollbar-handle.move {
background: #111;
}
.scrollbar-handle-up {
width: 20px;
height: 20px;
background: #DDD;
}
.scrollbar-handle-up:hover {
background: #666;
}
.scrollbar-handle-down {
width: 20px;
height: 20px;
background: #DDD;
}
.scrollbar-handle-down:hover {
background: #666;
}
/* ---------- simple theme --------------------------------------------------------------------- */
.simple .scrollbar-pane {
margin-right: 16px;
}
.simple .scrollbar-handle-container {
background: #EEE;
width: 15px;
}
.simple...
JavaScript
/*jslint eqeqeq: true, regexp: true */
/*global document, window, setInterval, clearInterval, handler, jQuery */
/*
* Scrollbar - a jQuery plugin for custom scrollbars
*
* @author Thomas Duerr, me@thomd.net
* @date 03.2010
* @requires jquery v1.4.2
*
*
* Usage:
*
* Append scrollbar to an arbitrary container with overflowed content:
*
* $('selector').scrollbar();
*
*
* Append scrollbar without arrows on top/bottom:
*
* $('selector').scrollbar({
* arrows: false
* });
*
*
*
* A vertical scrollbar is based on the following box model:
*
* +----------------------------------|
* | <----------------------------- content container
* | +-----------------+ +------+ |
* | | | | <-------------- handle arrow up
* | | | | | |
* | | | +------+ |
* | | | | +--+ | |
* | | | | | | | |
* | | | | | <-------------- handle
* | | | | | | | |
* | | | | | | | |
* | | | | | | | |
* | | | | +--+ | |
* | | | | | |
* | | | | <-------------- handle container
* | | | | | |
* | | <----------------------------- pane
* | | | | | |
* | | | | | |
* | | | +------+ |
* | | | | | |
* | | | | <-------------- handle arrow down
* | +-----------------+ +------+ |
* | |
* +----------------------------------|
*
*
*/
(function($, document){
$.fn.scrollbar = function(opts){
// Extend default options
var options = $.extend({}, $.fn.scrollbar.defaults, opts);
...