Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Perfect Scroll - Start scroll bar in the Middle of the Container?

How can I make my scrollbar start in the middle of my container using https://github.com/noraesae/perfect-scrollbar

I'm trying to cheat it by using

$(".trek_main_timeline_wrap").perfectScrollbar();

$(".trek_main_timeline_wrap .ps-scrollbar-y-rail").css({
                                                        "left" : "5px",
                                                        "top" : "200px"
                                                       });

But this is only pushing the scrollbar down, not the content inside of the container.

like image 622
Jason Biondo Avatar asked Nov 21 '25 16:11

Jason Biondo


1 Answers

You would just use scrollTop and update:

$('.ps-container').scrollTop(100).perfectScrollbar('update');
like image 117
Robbie Wxyz Avatar answered Nov 23 '25 04:11

Robbie Wxyz