For me, the answer suggested by the author @rochal does not work, neither scrollTo
nor scroll
as slimScroll configuration parameters: both scroll the content but not the handle, and one of them even destroys the container height in my case.
Instead, this worked for me:
// let's assume the plugin was initialized with this class name present:
$('.slim-scroll').slimScroll(config);
// then this is the solution.
$('.slimScrollDiv.inQuestion').find('.slimScrollBar').css({ top: 0 }).end().find('.slim-scroll').get(0).scrollTop = 0;
// -----------------------------
// once more, with explanations:
$('.slimScrollDiv.inQuestion') // this is the ‹div› wrapped around our .slim-scroll element by the plugin. It always has the 'slimScrollDiv' class name.
.find('.slimScrollBar') // first address the handle. The order is important because we're going to break the chain at the end.
.css({ top: 0 }) // 'scroll' it.
.end() // stay in the jQuery chain; go back to the last jQuery collection before find().
.find('.slim-scroll') // address the content.
.get(0) // leave jQuery terrain, get the DOM element.
.scrollTop = 0 // scroll it.
;