重置 jScrollPane 视口位置的正确方法
我一直在寻找答案,但我应用于自己代码的所有内容似乎都不起作用。我有一个包含内容的 DIV。当我单击链接时,DIV 淡出,内容通过 jQuery .html 事件更改,然后 DIV 淡入。这给人一种网站上页面发生轻微变化的错觉。该 DIV 有一个 jScrollPane,在按下任何链接之前它可以正常工作。
然而,发生的情况是,当内容被重写时,滚动窗格“可拖动区域”保持相同的大小,并且有或多或少,或者即使根本不需要一个。
我需要让滚动窗格“可拖动区域”更改与新内容相关的大小,并且我需要它在 .fadeTo 淡出和生效之间滚动回顶部。
我已经尝试了以下一些:
function showhome() {
$('#infohome').stop(true,true).fadeTo(100,0)
$('#infohome').delay(100).html("NEW CONTENT")
$('#infohome').stop(true,true).delay(200).fadeTo(100,1)
refreshNav();
function refreshNav() {
var element = $('.scroll-pane').jScrollPane({scrollToY(0, animate)});
var api = element.data('jsp');
}
以及:
myJScrollPane.getVerticalScrollbar().setValue(int Pos);
以及其他一些。
一如既往,任何帮助将不胜感激。
I've been looking around for answers and everything I apply to my own code doesn't seem to work. I have a DIV with content. When I click on a link the DIV fades out, the content changes via the jQuery .html event and then the DIV fades back in. This gives the illusion of a gentle page change on my site. This DIV has a jScrollPane which works fine before any links are pressed.
What is happening however is that the scroll pane 'draggable area' stays the same size when the content is re-written and there is more or less, or even if there is no need for one at all.
I need to get the scroll pane 'draggable area' to change size in relation to the new content and I need it to scroll back to the top inbetween the .fadeTo fade out and in effect.
I've tried some of the following:
function showhome() {
$('#infohome').stop(true,true).fadeTo(100,0)
$('#infohome').delay(100).html("NEW CONTENT")
$('#infohome').stop(true,true).delay(200).fadeTo(100,1)
refreshNav();
function refreshNav() {
var element = $('.scroll-pane').jScrollPane({scrollToY(0, animate)});
var api = element.data('jsp');
}
As well as:
myJScrollPane.getVerticalScrollbar().setValue(int Pos);
and a few others.
As always, any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论