Quickbox 与 MooTools 1.4
我一直在使用 MooTools 1.4 为我的网站尝试一些灯箱,我发现这个可以工作并且看起来非常好(易于实现):
http://andrewplummer.com/code/quickbox/
在演示网站上,灯箱工作完美,单击图像会弹出叠加层和图像,单击叠加层会删除 他们。
在我的网站上,当您单击适当标记的图像时,灯箱会弹出,一切正常,但是,当您通过单击叠加层或按 q/x/esc 退出灯箱时,叠加层会隐藏,一切看起来都很棒。唯一的问题是,由于某种原因,它被嵌入到我的代码正文中:
这导致的问题是,灯箱关闭后它不会被删除,所以整个页面在
#qbOverlay {
display: block;
position: absolute;
z-index: 100;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
这是一个问题,因为这使得该覆盖层覆盖在页面的整个顶部,并且在灯箱关闭后它永远不会被删除。当它像这样时,我无法单击任何链接或使用它所覆盖的区域中的任何输入框。
我有一种感觉,导致这个问题的原因是这样的:
close: function(){
this.quickBox.setStyle("display", "none");
this.quickBox.setStyle("cursor", "auto");
this.overlay.fade("out");
this.active = false;
}
我尝试使用 MooTools 的兼容模式并打开所有额外功能,但没有运气。
I've been trying out a few lightboxes for my website using MooTools 1.4, and I found this one that works and looks really nice (with easy implementation):
http://andrewplummer.com/code/quickbox/
On the demo website, the lightbox works perfectly, clicking the image brings up the overlay and image, and clicking the overlay removes them.
On my website, when you click an image that's marked appropriately, the lightbox pops up and everything works properly, however, when you exit the lightbox by clicking the overlay or pressing q/x/esc, the overlay hides and everything looks great. The only problem with this is that for some reason, this is being embedded into the body of my code:
<div id="qbOverlay" style="display: block; width: 100%; height: 100%; opacity: 0; "></div>
The problem that this causes is that it isn't ever removed after the lightbox is closed, so the entire page is blanked in
#qbOverlay {
display: block;
position: absolute;
z-index: 100;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
This is a problem because this makes the entire top of the page this overlay, and it's never removed after the lightbox is closed. When it's like this, I can't click any links or use any input boxes in the area that it's covering.
I have a feeling that the thing causing this problem is this:
close: function(){
this.quickBox.setStyle("display", "none");
this.quickBox.setStyle("cursor", "auto");
this.overlay.fade("out");
this.active = false;
}
I've tried using MooTools with compatibility mode and having every extra turned on, but with no luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 mootools 1.4 中的一个实际错误 https://github.com/mootools/mootools-core /issues/2074
它将于本周在 1.4.1 中修复(希望),但您可以采用更新的 Fx.tween 元素快捷方式原型此处淡入淡出的代码:
https://github.com/cpojer/mootools-core/commit/11b4257f12a51454bd513ab1ac32cd5239d66098
或者,在不透明度上使用简单的补间而不是
.fade()
,它据称有效。您还可以对覆盖层进行破坏,这对我来说是最好的解决办法This is an actual bug in mootools 1.4 https://github.com/mootools/mootools-core/issues/2074
Its about to be fixed this week in 1.4.1 (hopefully) but you can take the updated Fx.tween element shortcut protiotypes code for the fade here:
https://github.com/cpojer/mootools-core/commit/11b4257f12a51454bd513ab1ac32cd5239d66098
Alternatively, use a simple tween on opacity instead of
.fade()
, it allegedly works. You can also do a destroy on the overlay, which to me is the best fix