Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>Slim Scroll with both option h/v</title>
  </head>
  <body>
    
    <div class="container">
      <h1>Slim Scroll with both option h/v</h1>
      <div id="testDiv">
        <p>8.62 KB Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.</p>

      <p>Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>

      <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.</p>

    <p>Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.</p>

      <p>Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.</p>

    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.</p>

      <p>Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
      </div>
      <hr>
      <div id="testDiv2">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.</p>

      <p>Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>

      <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed pulvinar rhoncus quam, vel semper tellus viverra id. Nulla rutrum porttitor odio, a rutrum purus gravida non. Etiam ac purus augue, eget vestibulum purus. Aenean venenatis ullamcorper augue, non consequat elit tempor sed. Donec velit sapien, volutpat sed ultricies egestas, semper a ante. Fusce dapibus, quam eget auctor suscipit, nibh leo posuere ante, at auctor nisi lacus in sem. Morbi interdum consectetur euismod. Cras accumsan est lacus. Nulla eleifend, eros vel consequat commodo, arcu nunc malesuada nunc, quis sagittis felis sem ac turpis.</p>

    <p>Nulla rhoncus elementum convallis. Mauris condimentum aliquet egestas. Ut iaculis nisi eget tellus accumsan venenatis. Maecenas imperdiet aliquam porta. Aenean ultrices dolor sed quam laoreet varius. Curabitur condimentum blandit erat, quis accumsan eros interdum vitae. Curabitur ligula arcu, sollicitudin vitae iaculis sed, blandit sit amet enim. Morbi ullamcorper, metus vel mollis tristique, arcu turpis malesuada nisi, at dignissim lorem odio a orci. Proin ultrices, ipsum ut vestibulum interdum, libero felis auctor mi, vitae convallis nisl justo ac tellus. Integer nec lacinia turpis. Etiam massa nisl, rhoncus quis rutrum in, pretium eu leo. Proin a velit ut nulla laoreet vestibulum. Curabitur eu elit vitae felis auctor tincidunt. Curabitur tincidunt, metus sed sollicitudin cursus, quam elit commodo erat, ut tempor erat sapien vitae velit. Morbi nec viverra erat.</p>

      <p>Nullam scelerisque facilisis pretium. Vivamus lectus leo, commodo ac sagittis ac, dictum a mi. Donec quis massa ut libero malesuada commodo in et risus. Fusce nunc dolor, aliquet vel rutrum in, molestie sit amet massa. Aliquam suscipit, justo a commodo condimentum, enim sapien fringilla ante, sed lobortis orci lectus in ante. Donec vel interdum est. Donec placerat cursus lacus, eu ultricies nisl tincidunt a. Fusce libero risus, sagittis eleifend iaculis aliquet, condimentum vitae diam. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin leo purus, sodales a venenatis luctus, faucibus ac enim. Sed id metus ac sem lobortis pretium. Mauris faucibus tempor scelerisque. Nunc vulputate interdum tortor, non tincidunt dui condimentum eget. Aenean in porttitor velit. Nam accumsan rhoncus risus id consectetur.</p>

    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus, felis interdum condimentum consectetur, nisl libero elementum eros, vehicula congue lacus eros non diam. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus mauris lorem, lacinia id tempus non, imperdiet et leo. Cras sit amet erat sit amet lacus egestas placerat. Aenean ultricies ultrices mauris ac congue. In vel tortor vel velit tristique tempus ac id nisi. Proin quis lorem velit. Nunc dui dui, blandit a ullamcorper vitae, congue fringilla lectus. Aliquam ultricies malesuada feugiat. Vestibulum placerat turpis et eros lobortis vel semper sapien pulvinar.</p>

      <p>Pellentesque rhoncus aliquet porta. Sed vel magna eu turpis pharetra consequat ut vitae lectus. In molestie sollicitudin mi sit amet convallis. Aliquam erat volutpat. Nullam feugiat placerat ipsum eget malesuada. Nulla facilisis nunc non dolor vehicula pretium. Sed dui magna, sodales id pharetra non, ullamcorper eu sapien. Mauris ac consectetur leo. Mauris consequat, lectus ut bibendum pulvinar, leo magna feugiat enim, eu commodo lacus sem vel ante. Sed tempus metus eget leo mollis vulputate. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
      </div>
    </div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                !function(t){t.fn.extend({slimScroll:function(i){var e={axis:"y",width:"auto",height:"250px",size:"7px",color:"#000",positionX:"bottom",positionY:"right",distance:"1px",startX:"left",startY:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClassX:"slimScrollRailX",barClassX:"slimScrollBarX",railClassY:"slimScrollRailY",barClassY:"slimScrollBarY",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},o=t.extend(e,i);return o.axis=o.axis.toLowerCase(),this.each(function(){function e(t){var i=0,e=0;return"detail"in t&&(e=t.detail),"wheelDelta"in t&&(e=-1*t.wheelDelta/6),"wheelDeltaY"in t&&(e=-1*t.wheelDeltaY/6),"wheelDeltaX"in t&&(i=t.wheelDeltaX/6),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(i=-1*e,e=0),i!==i&&e!==e&&(i=0,e=t.wheelDelta),"deltaY"in t&&(e=t.deltaY),"deltaX"in t&&(i=t.deltaX),[i,e]}function s(i){if(m){i=i||window.event;var s=e(i),a=s[0],r=s[1],n=i.target||i.srcTarget||i.srcElement;t(n).closest("."+o.wrapperClass).is(E.parent())&&l(a,r,!0),i.preventDefault&&!V&&i.preventDefault(),V||(i.returnValue=!1)}}function l(t,i,e,s){if(V=!1,p){var l=t,a=E.outerWidth()-j.outerWidth();if(e&&(l=parseInt(j.css("left"))+t*parseInt(o.wheelStep)/100,l=Math.min(Math.max(l,0),a),l=t>0?Math.ceil(l):Math.floor(l),j.css({left:l+"px"})),W=parseInt(j.css("left"))/(E.outerWidth()-j.outerWidth()),l=W*(E[0].scrollWidth-E.outerWidth()),s){l=t;var r=l/E[0].scrollWidth*E.outerWidth();r=Math.min(Math.max(r,0),a),j.css({left:r+"px"})}E.scrollLeft(l),E.trigger("slimscrollingX",~~l),c(),u()}if(f){var n=i,g=E.outerHeight()-Q.outerHeight();if(e&&(n=parseInt(Q.css("top"))+i*parseInt(o.wheelStep)/100,n=Math.min(Math.max(n,0),g),n=i>0?Math.ceil(n):Math.floor(n),Q.css({top:n+"px"})),M=parseInt(Q.css("top"))/(E.outerHeight()-Q.outerHeight()),n=M*(E[0].scrollHeight-E.outerHeight()),s){n=i;var w=n/E[0].scrollHeight*E.outerHeight();w=Math.min(Math.max(w,0),g),Q.css({top:w+"px"})}E.scrollTop(n),E.trigger("slimscrollingY",~~n),d(),h()}}function a(t){window.addEventListener?(t.addEventListener("DOMMouseScroll",s,!1),t.addEventListener("mousewheel",s,!1)):document.attachEvent("onmousewheel",s)}function r(){if(j){I=Math.max(E.outerWidth()/E[0].scrollWidth*E.outerWidth(),O),j.css({width:I+"px"});var t=p&&E[0].scrollWidth>E[0].clientWidth?"block":"none";j.css({display:t})}}function n(){if(Q){R=Math.max(E.outerHeight()/E[0].scrollHeight*E.outerHeight(),B),Q.css({height:R+"px"});var t=f&&E[0].scrollHeight>E[0].clientHeight?"block":"none";Q.css({display:t})}}function c(){if(j){if(r(),clearTimeout(Y),W==~~W){if(V=o.allowPageScroll,H!=W){var t=0===~~W?"left":"right";E.trigger("slimscrollX",t)}}else V=!1;if(H=W,I>=E.outerWidth())return void(V=!0);j.stop(!0,!0).fadeIn("fast"),o.railVisible&&P.stop(!0,!0).fadeIn("fast")}}function u(){j&&(o.alwaysVisible||(Y=setTimeout(function(){o.disableFadeOut&&m||v||X||(j.fadeOut("slow"),P.fadeOut("slow"))},1e3)))}function d(){if(Q){if(n(),clearTimeout(y),M==~~M){if(V=o.allowPageScroll,D!=M){var t=0===~~M?"top":"bottom";E.trigger("slimscrollY",t)}}else V=!1;if(D=M,R>=E.outerHeight())return void(V=!0);Q.stop(!0,!0).fadeIn("fast"),o.railVisible&&N.stop(!0,!0).fadeIn("fast")}}function h(){Q&&(o.alwaysVisible||(y=setTimeout(function(){o.disableFadeOut&&m||x||X||(Q.fadeOut("slow"),N.fadeOut("slow"))},1e3)))}var p,f,g,w,b,m,v,x,X,Y,y,C,S,R,I,W,H,M,D,T="<div></div>",B=30,O=30,V=!1,E=t(this),k=t(document);if(E.parent().hasClass(o.wrapperClass)){t.extend(o,E.data("slimScrollConfig")||{});var z=E.scrollLeft(),L=E.scrollTop();return j=E.siblings("."+o.barClassX),P=E.siblings("."+o.railClassX),Q=E.siblings("."+o.barClassY),N=E.siblings("."+o.railClassY),p="both"==o.axis||"x"==o.axis,f="both"==o.axis||"y"==o.axis,r(),n(),t.isPlainObject(i)&&("width"in i&&p&&("auto"==i.width?(E.parent().css("width","auto"),E.css("width","auto"),o.width=E.parent().parent().width()):(o.width=i.width,E.css({"white-space":"nowrap"}))),"height"in i&&f&&("auto"==i.height?(E.parent().css("height","auto"),E.css("height","auto"),o.height=E.parent().parent().height()):o.height=i.height),E.parent().css({position:"relative",overflow:"hidden",width:o.width,height:o.height}),E.css({overflow:"hidden",width:o.width,height:o.height}),"scrollToX"in i?z=parseInt(o.scrollToX):"scrollByX"in i&&(z+=parseInt(o.scrollByX)),"scrollToY"in i?L=parseInt(o.scrollToY):"scrollByY"in i&&(L+=parseInt(o.scrollByY)),"destroy"in i)?(j.remove(),P.remove(),Q.remove(),N.remove(),void E.unwrap()):void l(z,L,!1,!0)}if(!(t.isPlainObject(i)&&"destroy"in i)){p="both"==o.axis||"x"==o.axis,f="both"==o.axis||"y"==o.axis,o.height="auto"==o.height?E.parent().height():o.height,o.width="auto"==o.width?E.parent().width():o.width,E.data("slimScrollConfig",o);var F=t(T).addClass(o.wrapperClass).css({position:"relative",overflow:"hidden",width:o.width,height:o.height});if(E.css({overflow:"hidden",width:o.width,height:o.height}),E.wrap(F),p){"auto"!=o.width&&p&&E.css({"white-space":"nowrap"});var P=t(T).addClass(o.railClassX).css({width:"100%",height:o.size,position:"absolute",left:0,display:o.alwaysVisible&&o.railVisible?"block":"none","border-radius":o.railBorderRadius,background:o.railColor,opacity:o.railOpacity,zIndex:90}),j=t(T).addClass(o.barClassX).css({background:o.color,height:o.size,position:"absolute",left:0,opacity:o.opacity,display:o.alwaysVisible?"block":"none","border-radius":o.borderRadius,BorderRadius:o.borderRadius,MozBorderRadius:o.borderRadius,WebkitBorderRadius:o.borderRadius,zIndex:99}),A="top"==o.positionX?{top:o.distance}:{bottom:o.distance};P.css(A),j.css(A),E.parent().append(j),E.parent().append(P),o.railDraggable&&(j.on("mousedown",function(t){return X=!0,g=parseFloat(j.css("left")),w=t.pageX,k.on("mousemove.slimscrollX",function(t){currLeft=g+t.pageX-w,j.css("left",currLeft),l(0,0,j.position().left)}),k.on("mouseup.slimscrollX",function(t){X=!1,u(),k.unbind(".slimscrollX")}),!1}).on("selectstart.slimscrollX",function(t){return t.stopPropagation(),t.preventDefault(),!1}),P.on("mousedown",function(t){var i=(t.offsetX-I/2)*E[0].scrollWidth/E.outerWidth();return l(i,0,!1,!0),g=parseFloat(j.css("left")),w=t.pageX,k.on("mousemove.slimscrollX",function(t){currLeft=g+t.pageX-w,j.css("left",currLeft),l(0,0,j.position().left)}),k.on("mouseup.slimscrollX",function(t){X=!1,u(),k.unbind(".slimscrollX")}),!1})),P.hover(function(){c()},function(){u()}),j.hover(function(){v=!0},function(){v=!1}),r(),"right"===o.startX?(j.css({left:E.outerWidth()-j.outerWidth()}),l(0,0,!0)):"left"!==o.startX&&(l(t(o.startX).position().left,null,null,!0),o.alwaysVisible||j.hide())}if(f){var N=t(T).addClass(o.railClassY).css({width:o.size,height:"100%",position:"absolute",top:0,display:o.alwaysVisible&&o.railVisible?"block":"none","border-radius":o.railBorderRadius,background:o.railColor,opacity:o.railOpacity,zIndex:90}),Q=t(T).addClass(o.barClassY).css({background:o.color,width:o.size,position:"absolute",top:0,opacity:o.opacity,display:o.alwaysVisible?"block":"none","border-radius":o.borderRadius,BorderRadius:o.borderRadius,MozBorderRadius:o.borderRadius,WebkitBorderRadius:o.borderRadius,zIndex:99}),Z="right"==o.positionY?{right:o.distance}:{left:o.distance};N.css(Z),Q.css(Z),E.parent().append(Q),E.parent().append(N),o.railDraggable&&(Q.on("mousedown",function(t){return X=!0,g=parseFloat(Q.css("top")),b=t.pageY,k.on("mousemove.slimscrollY",function(t){currTop=g+t.pageY-b,Q.css("top",currTop),l(0,0,Q.position().top)}),k.on("mouseup.slimscrollY",function(t){X=!1,h(),k.unbind(".slimscrollY")}),!1}).on("selectstart.slimscrollY",function(t){return t.stopPropagation(),t.preventDefault(),!1}),N.on("mousedown",function(t){var i=(t.offsetY-R/2)*E[0].scrollHeight/E.outerHeight();return l(0,i,!1,!0),g=parseFloat(Q.css("top")),b=t.pageY,k.on("mousemove.slimscrollY",function(t){currTop=g+t.pageY-b,Q.css("top",currTop),l(0,0,Q.position().top)}),k.on("mouseup.slimscrollY",function(t){X=!1,h(),k.unbind(".slimscrollY")}),!1})),N.hover(function(){d()},function(){h()}),Q.hover(function(){x=!0},function(){x=!1}),n(),"bottom"===o.startY?(Q.css({top:E.outerHeight()-Q.outerHeight()}),l(0,0,!0)):"top"!==o.startY&&(l(null,t(o.startY).position().top,null,!0),o.alwaysVisible||Q.hide())}E.hover(function(){m=!0,c(),d(),u(),h()},function(){m=!1,u(),h()}),E.on("touchstart",function(t,i){t.originalEvent.touches.length&&(C=t.originalEvent.touches[0].pageX,S=t.originalEvent.touches[0].pageY)}),E.on("touchmove",function(t){if(V||t.originalEvent.preventDefault(),t.originalEvent.touches.length){var i=(C-t.originalEvent.touches[0].pageX)/o.touchScrollStep,e=(S-t.originalEvent.touches[0].pageY)/o.touchScrollStep;l(i,e,!0),C=t.originalEvent.touches[0].pageX,S=t.originalEvent.touches[0].pageY}}),a(this)}}),this}}),t.fn.extend({slimscroll:t.fn.slimScroll})}(jQuery);




//This is initialization script
$(document).ready(function(){
  $('#testDiv').slimscroll({
    height: '200px',
    width: '500px',
    axis: 'x',
    railVisible: true,
		alwaysVisible: true
  });
  $('#testDiv2').slimscroll({
    height: '200px',
    width: '500px',
    axis: 'y',
    railVisible: true,
		alwaysVisible: true,
    color: '#000',
    railColor: '#000',
    railOpacity: 0.5,
    height: '500px',
    size: '10px',
  });
});
              
            
!
999px

Console