[编辑问题]
我正在使用图像预览工具提示,它利用了 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>
提前致谢。
最佳答案
我查看了 colorbox 页面,这里解释了所有内容。
看看这个,这正是您想要做的:example 1
关于javascript - 从文本链接打开 Colorbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3131611/