在 div 集中包含 Galleria Gallery 以不显示任何内容
我在 div 中有一个画廊,最初设置为不显示,这是因为我在同一页面上有 5 个这样的画廊,并且只想一次显示一个。现在,每当我单击链接显示其中一个画廊时,我都会收到一个致命错误:
Fatal error: Could not extract a stage height from the CSS. Traced height: 0px.
有没有办法解决这个问题?我的 javascript 知识不是很好,但任何帮助将不胜感激。
谢谢。
乔尼
I've got a gallery in div which is initially set to display none, this is because I have 5 of these galleries on the same page and only want one to display at any one time. Now whenever i click the link to display one of the galleries i'm getting a fatal error:
Fatal error: Could not extract a stage height from the CSS. Traced height: 0px.
Is there anyway to work around this? My javascript knowledge isn't great, but any help would be greatly appreciated.
Thanks.
Joni
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无论显示画廊容器的事件是什么,您都需要初始化画廊实例。
我也遇到了同样的问题 - 默认情况下,我的画廊在我的页面上是隐藏的(不显示),只有当您单击“查看画廊”链接时才会出现。使用 jQuery SlideDown(它将显示属性设置为阻止),然后我才调用初始化。
You need to intialize the gallery instance on whatever event it is that displays the gallery container.
I have been experiencing the same issue - my gallery is hidden (display none) by default on my page and only appears when you click a link "View gallery". Using jQuery slideDown (which sets the display property to block), only then do I call the initialize.
这个函数
你可以重新调用
但也许使用唯一的ID,这样你就不会做不必要的工作
Is this function
You may able to re-call
But maybe use unique ID's so you're not doing unneeded work
我会使用 javascript 在获得高度后隐藏元素。问题是它无法获取
display:none;
元素的高度,它的结构就像幽灵一样,无形。另外,我认为修复网站可以做的最简单的事情就是向与链接相关的每个链接添加 rel 标记,例如
rel="graphic"
和rel="packaging "
为每个 div 添加一个类似的标签。用它来切换不同的画廊。另外,您只针对一个带有 jquery Cycle 插件的画廊,我建议:
这样它就可以针对所有画廊。此外,Galleria 插件似乎至少在 jsFiddle 示例中不起作用。我认为它会与 jQuery Cycle 插件冲突。
我还会更改 onClick 处理程序以使用 rel 来了解要显示哪个图库。并使用类似的东西来隐藏剩余的内容。
我知道我所说的大部分内容与您最初的问题不太相关,但我将从这里开始,它可能会解决您最初的问题。 注意:我没有遇到您上面描述的相同错误
I would use javascript to hide the element after it obtains the height. The issue is that it cannot get the height of an element that is
display:none;
it's structure is like a ghost, intangible.Also I am thinking the easiest thing you can do to fix your site is adding a rel tag to each link that is pertinent to the link such as
rel="graphic"
andrel="packaging"
add a similar tag to each div that.Use that to toggle the different galleries. Also you are targeting only one gallery with the jquery cycle plugin, I would suggest:
That way it targets all of them. Also the Galleria plugin seems to not work at least in the jsFiddle example. I would assume that it would conflict with the jQuery Cycle plugin.
I would also change the onClick handler to use the rel to know which gallery to display. And to hide the remaining using something as such.
I know most of what I said is not too pertinent with your original question but I would start here it may fix your initial issue. Note: I did not run into the same error you described above