Automatically scroll to bottom of div using Tiny Scrollbar

前端 未结 4 1503
悲哀的现实
悲哀的现实 2021-01-26 10:12

I\'m coding a shoutbox and making it as user friendly as possible. It uses the Tiny Scrollbar plugin for jQuery and I want to incorporate an extra function that will allow me to

4条回答
  •  暖寄归人
    2021-01-26 11:07

    I had this same need. To address it, add the following function into the code after the this.update function:

    this.bottom = function(){
      iScroll = oContent[options.axis] - oViewport[options.axis];
      oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
      oContent.obj.css(sDirection, -iScroll);
    };
    

    Then, on your page, add a call to bottom() after your scrollbar's update() call:

    scrollBar.update();
    scrollBar.bottom();
    

    Seems to work fine for me.

    Robby

提交回复
热议问题