NiceScroll doesn't work after AJAX loading

ajax, jquery, scroll

Solution

When content on your div changes you need to call nicescroll resize method.

$("your-div-name").getNiceScroll().resize()

Keep in mind if image size is not set in img tag, you need to call resize when all images are fully loaded.

Problem

I have a problem with Nice Scroll. It works fine, but when I load AJAX images it doesn't work. Interestingly, when I resize the window, open Firebug or whatever, it starts to work. What can I do to do this automatically? I tried: ``` setTimeout(function(){ $("window").trigger('resize'); }, 0); ``` After the AJAX loading function, but it doesn't work.

Original source