fancybox 中的 Jscrollpane 不起作用
我在 fancybox 中使用 jscrollpane 时遇到问题。 尽管经过一场噩梦般的努力,我使自定义滚动条出现,但它仅在我第一次打开灯箱时出现。当我关闭灯箱并尝试再次打开它时,jscrollpane 似乎找不到任何内容,因此无法正常运行。
不断观察 firebug,我注意到当我关闭 lightbox 时,只有 jspScrollable 类(由 jscrollpane 添加)保留,但所有额外的 html 都消失了。当我再次打开它时,不再创建额外的 html。看来这次 jscrollpane 在内容加载之前运行。
这是我的脚本:
<script type="text/javascript" >
$(document).ready(function() {
$("a.enlarge-image").fancybox(
{
'overlayColor' : '#000',
'overlayOpacity' : '0.6',
'autoScale' : false,
'onComplete' : (function(){
$('#fancybox-content').jScrollPane();
})
})
})
</script>
任何帮助将不胜感激。
I have a problem using the jscrollpane in a fancybox.
Although after a nightmare of efforts I made the custom scrollbar to appear, it only appears the first time I open the lightbox. When I close the lightbox, and try to open it again, it looks like the jscrollpane finds no content and consequently doesn't run properly.
Having a constant look at the firebug, I notice that when I close the lightbox, only the jspScrollable class (added by the jscrollpane) remains but all of the extra html is gone. When I open it again, the extra html is not created any more. It looks that this time the jscrollpane runs before the content is loaded.
Here is my script:
<script type="text/javascript" >
$(document).ready(function() {
$("a.enlarge-image").fancybox(
{
'overlayColor' : '#000',
'overlayOpacity' : '0.6',
'autoScale' : false,
'onComplete' : (function(){
$('#fancybox-content').jScrollPane();
})
})
})
</script>
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我终于解决了这个问题。我首先创建了一个 jscrollpane 对象,每次关闭 fancybox (onClosed) 时都会销毁该对象,并在每次打开 fancybox (onComplete) 时重新创建它。
现在这是我的脚本:
这似乎使 fancybox 和里面的 jscrollpane 完美地协同工作。
然而,我在 IE7 和 IE7 上发现了一个问题。 IE6浏览器。因此,当我关闭覆盖窗口时,我收到此错误:'0.nodeName' is null or not an Object
我认为问题在于,当我在关闭时销毁滚动窗格时,没有声明的变量滚动窗格。我只是不知道如何解决这个问题。
有什么想法吗?干杯..
I finally worked this out. I firstly created an jscrollpane object which I destroy everytime I close the fancybox (onClosed) and recreate it again every time I open the fancybox (onComplete).
So here is my script now:
This seems to make the fancybox and the jscrollpane inside working perfect together.
However, I discovered a problem just on IE7 & IE6 browsers. So when I close the overlay window I get this error: '0.nodeName' is null or not an Object
I think that the problem is that when I destroy the scrollpane onClose, then there is no declared variable scrollpane. I just don't know how to fix that.
Any thoughts please? Cheers..
遇到了同样的问题,花了大约 10 个小时让滚动窗格在 fancybox 中工作。
所以。您应该使用旧的花哨 1.3.4,并使用 jscrollpane 版本:2.0.0beta12,上次更新:2012-09-27来自演示的 github。
JS 代码:
要使其在关闭并单击下一个按钮后正常工作,只有一件事就是添加到 jquery.jscrollpane.js 第 89 行。
Had the same issue and spent about 10 hours to make the scrollpane works in the fancybox.
So. You should use an old fancy 1.3.4, and use a jscrollpane Version: 2.0.0beta12, Last updated: 2012-09-27 from github from demo.
JS code:
And only one thing to make it work fine after closing and next button clicking is add to the jquery.jscrollpane.js 89'th line.