如何在 jQuery Galleria 插件中自动切换 showinfo?
我似乎在任何地方都找不到这个记录。基本上我只是想让标题在整个幻灯片中自动显示...
提前致谢...
I can't seem to find this documented anywhere. Basically I just want to have the caption automatically be displayed throughout the slideshow...
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
假设您使用的是经典主题:
http://galleria.aino.se/docs/1.2/themes/classic /
Assuming you are using the Classic theme:
http://galleria.aino.se/docs/1.2/themes/classic/
我希望在加载画廊时自动显示标题,而不是切换可以再次隐藏标题的切换按钮。 (但我不确定这是否是洛根想要的)。
rodbot 提出的解决方案似乎正是我正在寻找的。
但只是为了完成他的建议 - 不要忘记确保在加载画廊后触发点击。如 http://galleria.aino.se/docs/1.2/references/extending 上所述/ - 为此,您必须将点击逻辑放在“extend: function(options)”内。我还使用更多“更高级”的 Galleria.get(0).$('info-link') 来获取元素。
完整的示例:
仅将“$(”.galleria-info-link”).click()”放在带有画廊加载的脚本后面对我来说不起作用,因为用于显示标题的元素(我们要单击的)是尚未创建。
希望这可以节省某人几分钟的谷歌搜索时间,我需要找到这个解决方案:-)
I wanted to have the caption displayed automatically when the galleria is loaded, but not switch of the toggle button which can hide the caption again. (I am not sure though if this was what Logan wanted).
The solution proposed by rodbot seemed to be what what I was looking for.
But just to complete his proposal - do not forget to ensure, that you trigger the click AFTER the galleria is loaded. As documented on http://galleria.aino.se/docs/1.2/references/extending/ - to do that, you must place the clicking logic inside "extend: function(options)". I am also using more "fancier" Galleria.get(0).$('info-link') to get the element.
Complete example:
Just placing the "$(".galleria-info-link").click()" after the script with galleria loading did not work for me, because the element for displaying the caption (which we want to click) is not yet created.
Hopefully this can save someone a few minutes of googling which I needed to find this solution :-)
如果您使用 Drupal,正确设置 Galleria 后,您可以按照以下步骤进行操作。我假设您正在运行经典主题(相同的策略可能适用于其他主题)。
在您的sites/all/libraries/galleria/themes/classic 文件夹中,您将看到两个.js 文件:
Drupal 自然指向galleria.classic.min.js 文件。虽然两个 .js 文件之间的代码不同,但它们的实现类似。因此,一个简单的策略是执行以下操作:
如果您愿意,您可以进一步主题化画廊。只需要认识到,如果您升级到较新版本的 Galleria,您将必须重新实现更改,因此保留更改日志可能会更好。另外,作为旁注,有些人可能更喜欢在原始的 galleria.classic.min.js 中进行这些更改——我不喜欢这样做,因为它读起来很混乱。
编辑:
如果您决定使用 Michael Aron 的方法,以下是新的 galleria.classic.min.js 文件中的内容。 (1.2.7 版)
If you are using Drupal, here is how you do it once you get Galleria set up properly. I'll assume you're running the Classic theme (same strategy likely works for other themes).
In your sites/all/libraries/galleria/themes/classic folder, you'll see two .js files:
Drupal naturally points to the galleria.classic.min.js file. While the code is different between the two .js files, their implementation is similar. Therefore a simple strategy is to do the following:
If you want you can further theme the Galleria. Just recognize if you upgrade to a newer verision of Galleria you'll have to reimplement you changes, so it might be good to keep a changelog. Also as a sidenote, some people might prefer to make these changes in the original galleria.classic.min.js -- I prefer not to because it's confusing to read.
EDIT:
If you decide to use Michael Aron's approach, here is what belongs in your new galleria.classic.min.js file. (v 1.2.7)
要自动显示标题,请尝试在 jQuery 中触发单击事件:
$(".galleria-info-link").click()
To show the caption automatically, try triggering a click event in jQuery:
$(".galleria-info-link").click()
这是默认显示标题并仍然有“X”来关闭它的解决方案(使用 jQuery):
Here is the solution (using jQuery) to have the caption displayed by default and still have the "X" to close it: