从文本链接打开 Colorbox
[编辑问题]
我正在使用图像预览工具提示,它使用 rel 属性,因此对于颜色框,我使用 class="slideshow" 将图像分组在一起。我的工作正常,但我希望能够从文本链接打开幻灯片,如下所示。
(rel =“medium.jpg”是用于图像预览的图像)
<div id='gallery'>
<a href='large.jpg' class="slideshow" rel='medium.jpg'><img src='small.jpg'/></a>
<a href='large2.jpg' class="slideshow" rel='medium2.jpg'><img src='small.2jpg'/></a>
</div>
<!--text link-->
<a href="#" class="openSlideshow">open slideshow</a>
下面是触发颜色框的标准代码,我如何修改它以打开幻灯片?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="../colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$("a.openSlideshow").colorbox({slideshow:true});
});
</script>
提前致谢。
[EDITED QUESTION]
I am using an image preview tooltip, which is making use of the rel attribute, so for the colorbox i am using the class="slideshow" to group the images together. I have this working fine, but i'd like to be able to open the slideshow from a text link, seen below.
(rel="medium.jpg" is the image used for the image preview)
<div id='gallery'>
<a href='large.jpg' class="slideshow" rel='medium.jpg'><img src='small.jpg'/></a>
<a href='large2.jpg' class="slideshow" rel='medium2.jpg'><img src='small.2jpg'/></a>
</div>
<!--text link-->
<a href="#" class="openSlideshow">open slideshow</a>
Below is the standard code to trigger the colorbox, how can i modify this to open the slideshow?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="../colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$("a.openSlideshow").colorbox({slideshow:true});
});
</script>
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我查看了 colorbox 页面,这里解释了所有内容。
看看这个,这正是您想要做的: 示例 1
I looked at colorbox page and everything is explained here.
Look at this, it's exactly what you are trying to do : example 1
嗯,当我尝试 Kai 的建议时,它不起作用
使用示例页面:
Hmm when I try Kai's suggestion it does not work
Using the example page:
只需在动态创建图库后对其进行扩展即可。
Just extend it after dynamically creating the gallery.