admin管理员组

文章数量:1287591

How can I make my scrollbar start in the middle of my container using

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.

How can I make my scrollbar start in the middle of my container using https://github./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.

Share Improve this question asked Nov 5, 2013 at 17:11 Jason BiondoJason Biondo 8345 gold badges18 silver badges37 bronze badges 2
  • can you share your HTML code? – Sid M Commented Nov 5, 2013 at 17:18
  • Could you give us a jsfiddle? – Robin Commented Nov 5, 2013 at 19:38
Add a ment  | 

1 Answer 1

Reset to default 11

You would just use scrollTop and update:

$('.ps-container').scrollTop(100).perfectScrollbar('update');

本文标签: javascriptjQuery Perfect ScrollStart scroll bar in the Middle of the ContainerStack Overflow