I have same div which dynamically loads content. How can I reset the scrollbar every time content is loaded, so new content always starts from the top, not where the last scrollbar position was?
I tried destroy / initialize on each reload, but scrollbar stays where he was previously left?
You can just set the scrollTop to 0 and the update.
// jQuery
$container.scrollTop(0);
$container.perfectScrollbar('update');
// vanilla JS
container.scrollTop = 0;
Ps.update(container);
Most helpful comment
You can just set the scrollTop to 0 and the update.