Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Nice scroll not working

I am using Jquery nice Scroll bar for div, but when content of div increases dynamically its not showing scroll bar. Windows default scroll bar works fine if i remove nice scroll. Can anyone help me to solve this problem?

Html

<div id="div-to-scroll">
</div>

Script

$(document).ready(function(e) {
    var nice = $("#div-to-scroll").getNiceScroll();
    $("#div-to-scroll").niceScroll();
    $("#div-to-scroll").getNiceScroll().resize();
});

this is my code sample.

like image 922
gaurang171 Avatar asked Aug 08 '12 10:08

gaurang171


2 Answers

Finally this works for me.

$("#div-to-scroll").scroll(function(){
  $("#div-to-scroll").getNiceScroll().resize();
});
like image 182
gaurang171 Avatar answered Oct 12 '22 09:10

gaurang171


for me works just with

$("#div-to-scroll").mouseover(function() {
    $("#div-to-scroll").getNiceScroll().resize();
});
like image 30
Karolis Gerbauskas Avatar answered Oct 12 '22 10:10

Karolis Gerbauskas