应用scrollTo时,jScrollPane滚动条消失 [英] jScrollPane scrollbar disappears when applying scrollTo
问题描述
我对jQuery扩展 jScrollPane 有疑问,并与
I have a problem with the jQuery extension jScrollPane combined with the scrollTo plugin. The scrollbar disappears if I apply the scrollTo
command to the scrollable container and the scroll is at the top position. (If the scroll is not at the top position, everything is working fine.)
要恢复滚动条,我尝试重新初始化它.然后发生的事情是滚动返回顶部,取消了scrollTo
命令.
To get the scrollbar back, I try to reinitialize it. What happens then is that the scroll goes back to the top, canceling the scrollTo
command.
我的代码:
$('#myScrollableDiv div.jspContainer').scrollTo(delta);
c = $('#myScrollableDiv').jScrollPane({
autoReinitialise: true,
maintainPosition: true
});
推荐答案
如果使用jScrollPane,则必须使用jScrollPane的功能向下滚动.
If you use jScrollPane, you have to use the functions of jScrollPane to scroll down.
var delta = 20;
var element = $('#myContainer').jScrollPane();
var api = element.data('jsp');
$('#scroll').click(function() {
api.scrollByY(delta);
});
有关 jScrollPane Api 的信息,请参阅api变量的功能列表.
Refer the jScrollPane Api for a list of functions for the api variable.
注意:当您省略文本周围的p
标记时,此功能将无效.
Note: It doesn't work when you omit the p
tags around the text.
这篇关于应用scrollTo时,jScrollPane滚动条消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!