niceScroll cursor height

PDIuserr picture PDIuserr · Sep 17, 2013 · Viewed 7.8k times · Source

I am using jquery nicescroll (http://areaaperta.com/nicescroll/).

I want to adjust the height of the cursor which seems pretty straight forward by adding the cursorminheight parameter. This does not work.

HTML

<div class="viewport-scrollbox">
<div class="wrapper-content-scrollbox">
    <ul class="client-gallery">
    <li><img src="image1.jpg" alt="" /></li>
    <li><img src="image2.jpg" alt="" /></li>
    <li><img src="image3.jpg" alt="" /></li>
    </ul>
</div><!--close wrapper-content-scrollbox-->
</div><!--close viewport-scrollbox-->

CSS

.viewport-scrollbox{
height:500px;
overflow:auto;
margin-bottom:20px;
margin-right:auto;
margin-left:auto;
}

JS

<script src="js/jquery.nicescroll.min.js"></script>
<script type="text/javascript">
$(document).ready(
  function() {
    $("html").niceScroll({cursorwidth:10}); /* main scrollbar on page*/
    $(".viewport-scrollbox").niceScroll(".wrapper-content-scrollbox",{touchbehavior:false,cursorcolor:"#898989",cursoropacitymax:0.7,cursorwidth:6,background:"#ccc",autohidemode:false});/*customize scrollbar for gallery*/
    $("#ascrail2001").css({'top': '14px','right':'22px'});/*position scrollbar for gallery*/

  }
);
</script>

I've tried these 2 options which do NOT work:

$(".viewport-scrollbox").niceScroll(".wrapper-content-scrollbox",{touchbehavior:false,cursorcolor:"#898989",cursoropacitymax:0.7,cursorwidth:6,background:"#ccc",autohidemode:false,cursorminheight:50});

and

$("div#ascrail2001.nicescroll-rails div").css('height','50px');

Thank you for your help!

Answer

Gaurav Mall picture Gaurav Mall · Jan 3, 2014

You can use the inbuilt feature of nice scroll. As shown below.

$(yourElement).niceScroll({
    cursorfixedheight: 70
});

Hope this helps!!