gpt4 book ai didi

javascript - SlimScroll JQuery 插件中 scrollto 的问题

转载 作者:行者123 更新时间:2023-11-30 10:06:36 26 4
gpt4 key购买 nike

我有 2 个带有 Slimscroll 插件的 DIV。两者都工作正常,但应该一直向上滚动一个 <div id="msg_left_sidebar">....</div> (似乎是默认的)和另一个 DIV <div id="chat_content">....</div>一直往下。使用以下代码,它几乎可以按预期工作:

$(function(){
var scrollDown_int = $('#chat_content')[0].scrollHeight;
$('#msg_left_sidebar').slimScroll({
height: (browserheight - 190) +'px',
width: '248px'
});
$('#chat_content').slimScroll({
height: (browserheight - (207 + 190)) +'px',
width: '526px',
scrollTo : scrollDown_int+'px',
});
//$('#chat_content').scrollTop(scrollDown_int); // this works as good as the scrollTo parameter
});

我遇到的问题是:即使内容一直滚动到底部,滚动条本身位于 DIV 元素的顶部。

这意味着,一旦我开始滚动,无论如何(鼠标上的滚轮或捕获滚动条)内容都会一直向上......

这是一个已知问题吗?我怎样才能让这个滚动条也到底部。

请帮忙。希望我的解释足够清楚:-)

最佳答案

Slimscroll 有一个容器起始位置的选项:

start - top or bottom or $(selector) - defines initial position of the scrollbar. When set to bottom it automatically scrolls to the bottom of the scrollable container. When HTML element is passed, slimScroll defaults to offsetTop of this element. Default: top.

发件人:http://rocha.la/jQuery-slimScroll

如果您将代码调整为以下内容,则 div 和滚动条都将放置在容器的底部:

$('#chat_content').slimScroll({
height: (browserheight - (207 + 190)) +'px',
width: '300px',
start: 'bottom'
});

JSFiddle:http://jsfiddle.net/oqet7pe4/

关于javascript - SlimScroll JQuery 插件中 scrollto 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28796367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com