针对 jquery 问题的 JScrollPane 插件。定制但遇到麻烦
好的,所以我尝试使用 jquery 的 jscrollpane 插件,它工作正常。问题是我试图实现一种效果,要求滚动条位于初始化时最初传递给它的包含 div 之外。我通过简单地更改此内容来实现此工作:
container.append(
$('<div class="jspVerticalBar" />').append(
$('<div class="jspCap jspCapTop" />'),
$('<div class="jspTrack" />').append(
$('<div class="jspDrag" />').append(
$('<div class="jspDragTop" />'),
$('<div class="jspDragBottom" />')
)
),
$('<div class="jspCap jspCapBottom" />')
)
);
verticalBar = container.find('>.jspVerticalBar');
对此:
container.parent().parent().append(
$('<div class="jspVerticalBar" />').append(
$('<div class="jspCap jspCapTop" />'),
$('<div class="jspTrack" />').append(
$('<div class="jspDrag" />').append(
$('<div class="jspDragTop" />'),
$('<div class="jspDragBottom" />')
)
),
$('<div class="jspCap jspCapBottom" />')
)
);
verticalBar = container.parent().parent().find('>.jspVerticalBar');
但是问题是,当内容不需要滚动条时,它仍然会调整窗格大小以为滚动条留出空间。我似乎无法找出问题所在。我对 jquery 还很陌生,所以尝试调试它很困难,所以任何帮助将不胜感激。
ok so I'm trying to use jscrollpane plugin for jquery and it works fine. The issue is i'm trying to achieve an affect that requires the scroll bar to be outside the containing div that is initially passed to it when initialized. I got this working by simply changing this:
container.append(
$('<div class="jspVerticalBar" />').append(
$('<div class="jspCap jspCapTop" />'),
$('<div class="jspTrack" />').append(
$('<div class="jspDrag" />').append(
$('<div class="jspDragTop" />'),
$('<div class="jspDragBottom" />')
)
),
$('<div class="jspCap jspCapBottom" />')
)
);
verticalBar = container.find('>.jspVerticalBar');
To this:
container.parent().parent().append(
$('<div class="jspVerticalBar" />').append(
$('<div class="jspCap jspCapTop" />'),
$('<div class="jspTrack" />').append(
$('<div class="jspDrag" />').append(
$('<div class="jspDragTop" />'),
$('<div class="jspDragBottom" />')
)
),
$('<div class="jspCap jspCapBottom" />')
)
);
verticalBar = container.parent().parent().find('>.jspVerticalBar');
The issue however is that when the content doesn't require a scroll bar it still resizes the pane to leave space for the scroll bar. I can't seem to track down the issue. I'm still fairly new to jquery so it's been rough trying to debug this so any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
近乎!我想我明白了!在API中找到了“destroy()”函数。我在 V 和 H 滚动都为 false 时添加了“
这会删除所有内容并保持格式良好。
NM! I think I got it! Found the "destroy()" function in the API. I added that in at the end of when both V and H scrolls are false "
That strips out everything and keeps the formatting happy.