Richard Rodriguez Richard Rodriguez - 1 year ago 84
Javascript Question

Nanoscroller doesn't create a scroll if the content is inserted after the scroller is initiated

I'm using nanoscroller js to create a scrollable area in a

element. The problem is that I'm filling that
element with data with ajax (imagine facebook notifications). First there are 0 notifications, no data. Then I fill it with 10. The scrollbar isn't there. When I refresh the page (with 10 notifications now already there), it creates itself, because it knows there is more content than there is room.

How can I make it create the scroller when the data is filled?

Answer Source

Reinitialize the nanoScroller $("your scrollable").nanoScroller(); after you inserted the content...


$("your content div").append("something");
$("your scrollable container").nanoScroller();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download