JSFiddle - React, Tailwind, and code Playground
by ignaciocorreia
HTML
<script src="https://raw.github.com/jamesflorentino/nanoScrollerJS/master/bin/javascripts/jquery.nanoscroller.min.js"></script>
<div id="stuff" class="nano">
<div class="content">
<ul>
<li style="height:1000px;"><span >hello</span></li>
</ul>
</div>
</div>
CSS
#stuff{
height:200px;
width:200px;
background:rgba(0,0,0,.2);
}
#stuff ul{
list-style:none;
}
#stuff ul li{
height:70px;
border:1px solid black;
border-bottom:0;
}
#stuff ul li:last-child{
border-bottom:1px solid black;
}
/** initial setup **/
.nano {
position : relative;
width : 100%;
height : 100%;
overflow : hidden;
}
.nano .content {
position : absolute;
overflow : scroll;
overflow-x : hidden;
top : 0;
right : 0;
bottom : 0;
left : 0;
}
.nano .content::-webkit-scrollbar {
visibility: hidden;
}
.has-scrollbar .content::-webkit-scrollbar {
visibility: visible;
}
.nano > .pane {
background : rgba(0,0,0,.0);
position : absolute;
width : 9px;
right : 5px;
top : 5px;
bottom : 5px;
visibility : hidden\9; /* Target only IE7 and IE8 with this hack */
opacity : .01;
-webkit-transition : .2s;
-moz-transition : .2s;
-o-transition : .2s;
transition : .2s;
-moz-border-radius : 5px;
-webkit-border-radius : 5px;
border-radius : 5px;
}
.nano > .pane > .slider {
background: rgba(0,0,0,.505);
box-shadow:0 0 0 1px rgba(255,255,255,.5);
position : relative;
margin : 0 1px;
-moz-border-radius : 3px;
-webkit-border-radius : 3px;
border-radius : 3px;
}
.nano:hover > .pane, .pane.active, .pane.flashed {
visibility : visible\9; /* Target only IE7 and IE8 with this hack */
opacity : 1;
}
JavaScript
$(function() {
$('.nano').nanoScroller();
});