Opera 浏览器中使用 Galleria.js 进行图像对齐
我相信有人可以帮助解决我的问题。我在用户使用流行的 Opera 浏览器访问我的网站 (www.amigaos.net) 时遇到问题;如果有人也想在 IE 中进行测试,那就太好了,但作为 Mac 用户,我会避免使用劣质浏览器。
我使用的是 Galleria v 1.1.95 并安装了 Opera beta 11,但我了解以前版本中也发生过的布局问题(来自用户反馈)。
因此,如果您使用 Opera 访问 www.amigaos.net 并单击顶部菜单中的游戏,则 galleria.js 会立即加载图库,您应该注意到主图库图像在舞台中左对齐,这是不正确的行为。 Safari 和 FireFox 都将图像居中。
我不知道应该在 galleria.classic.css、html 或 .js 本身中查找何处 - 如何让 Opera 将图像正确定位在舞台中央?请指教。
提前致谢。
I trust someone can help with my issue. I have a problem with users visiting my site (www.amigaos.net) using the popular Opera Browser; if someone would like to test in IE as well that would be great, but as a Mac user I avoid inferior browsers.
I am using Galleria v 1.1.95 and have Opera beta 11 installed, but I understand the layout problem (from user feedback) that it happens in previous versions as well.
So if you visit www.amigaos.net using Opera and click Games from the top menu, galleria.js loads the gallery and straightaway you should notice that the main gallery image is left-aligned in the stage which is incorrect behaviour. Both Safari and FireFox centre the image.
I don't know where I should be looking in galleria.classic.css, the html or the .js itself - how do I get Opera to correctly position the image in the centre of the stage? Advice please.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看到的问题(图像根本没有出现)是由 Galleria.js 设置高度:0 引起的。它无法读取 Opera 中舞台 (
) 的高度 - 即使为父元素提供了明确的高度,该元素的 offsetHeight 也会返回 0。 (事实证明,这是 Opera 中的一个已知错误,如果给定父级明确的高度,设置了顶部和底部的定位子级仍会报告 offsetHeight 0。)
我猜脚本可以检测到这一点。我不完全确定为什么他们需要读取这个 DIV 的高度,因为他们知道其父级的高度 - 但我想这样做是为了使主题和样式更加灵活。
我真的没有一个好的解决方法给你 - 也许指定 .galleria-stage{min-height:100%} 或从 JS 显式设置其高度可以吗?不过,我会跟进该错误,以便它应该在某个时候得到修复。
The problem I see (image not appearing at all) is caused by Galleria.js setting a height:0. It fails to read the height of the stage (
<div class="galleria-stage">
) in Opera - offsetHeight of this element returns 0 even after giving the parent an explicit height. (This turns out to be a known bug in Opera where a positioned child with top and bottom set still reports offsetHeight 0 if parent is given an explicit height.)I guess the script could detect this. I'm not entirely sure why they need to read the height of this DIV since they know the height of its parent - but I guess it's done this way to make theming and styling more flexible.
I don't really have a good workaround for you - perhaps specifying .galleria-stage{min-height:100%} or setting its height explicitly from JS would do? I will however follow up the bug so it should get fixed at some point..