最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery Perfect Scroll - Set Scrollbar to the Bottom of the Container - Stack Overflow

programmeradmin7浏览0评论

I have just installed perfect scroll, the jQuery plugin, and it works great but I can't find a parameter to start the content at the bottom of my div. I want to have to scroll up on page load, not to have to scroll down.

Normally with jQuery I would just do:

$(nav_message_list).prop({ scrollTop: $(nav_message_list).prop("scrollHeight")});

But that seems to have no effect.

Current code:

$(".chat_person").click(function ()
                         {
                          if (!$(".chat_content_wrap").is(":visible"))
                           {  
                            $(".chat_content_wrap").fadeIn(300, function ()   
                                                                 {
                                                                  $('#message_list').perfectScrollbar('update');
                                                                  $(nav_message_list).prop({ scrollTop: $(nav_message_list).prop("scrollHeight")});
                                                                 });
                           }
                          });

$("#message_list").perfectScrollbar();

I have just installed perfect scroll, the jQuery plugin, and it works great but I can't find a parameter to start the content at the bottom of my div. I want to have to scroll up on page load, not to have to scroll down.

Normally with jQuery I would just do:

$(nav_message_list).prop({ scrollTop: $(nav_message_list).prop("scrollHeight")});

But that seems to have no effect.

Current code:

$(".chat_person").click(function ()
                         {
                          if (!$(".chat_content_wrap").is(":visible"))
                           {  
                            $(".chat_content_wrap").fadeIn(300, function ()   
                                                                 {
                                                                  $('#message_list').perfectScrollbar('update');
                                                                  $(nav_message_list).prop({ scrollTop: $(nav_message_list).prop("scrollHeight")});
                                                                 });
                           }
                          });

$("#message_list").perfectScrollbar();
Share Improve this question asked Oct 17, 2013 at 4:05 Jason BiondoJason Biondo 8345 gold badges18 silver badges37 bronze badges 2
  • show some html or can you set fiddle – Rituraj ratan Commented Oct 17, 2013 at 4:12
  • see stackoverflow.com/questions/19418087/… this.. Me too using this only... – KarSho Commented Oct 17, 2013 at 5:02
Add a comment  | 

2 Answers 2

Reset to default 17

I haven't used the plugin before but based on the docs at https://github.com/noraesae/perfect-scrollbar

The code you should need is:

$("#message_list").scrollTop( $( "#message_list" ).prop( "scrollHeight" ) );
$("#message_list").perfectScrollbar('update');

The $ selectors may be wrong since I can't see you HTML code.

Scrooltop

paste below JavaScript code just before </head> code.

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

paste below JavaScript code just <body> code.

    <div class="scrool">
<script type="text/javascript" src="http://static.tumblr.com/ikeq9mi/DfYl6o46t/scrolltotop.min.js"></script>
    <a href="javascript:;" id="scrollToTop" rel="nofollow" title="Go to Top"><img src="http://static.tumblr.com/cqpvki8/7yWlh05zn/seta.png" title="Go to Top" alt="Go to Top"/></a>
</div>

Now on the Customize page, Go and Hit the button “Edit HTML” and add below css codes just before

#scrollToTop:link, 
#scrollToTop:visited {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
}

For reference http://www.tumblings.net/post/38379026809/scrolltotopbuttoncode Use this code

发布评论

评论列表(0)

  1. 暂无评论