inuyaksa / jquery.nicescroll

nicescroll plugin for jquery - scrollbars like iphone/ipad
https://nicescroll.areaaperta.com/
3.6k stars 1.67k forks source link

Default scroll down #693

Open PandaaAgency opened 7 years ago

PandaaAgency commented 7 years ago

Hi !

i'm using your nice plugin to create an inbox component (like facebook one). Everything is OK, i have just one question : I would like the component to be scrolled down by default. I use the following line :

$('.chat-body').getNiceScroll(0).doScrollTop($('.chat-body').get(0).scrollHeight, -1);

But it does it with an animation i would like it to initialize at bottom. Any idea ?

Thanks Flo

classikd commented 7 years ago

Hello, Try setting the smoothscroll property to false in the constructor. Maybe you'll have to put it back to true then, if needed.

inuyaksa commented 7 years ago

Use jquery scrollTop. $('.chat-body').scrollTop($('.chat-body').get(0).scrollHeight, -1);

PandaaAgency commented 7 years ago

Perfect ! Both answers works well (but i'll use @inuyaksa 's one : simpler and don't have to set the smoothscroll to true after )

Thanks !