我在一个相当标准的实现中使用Lightbox2:单击系列中的图像(全部带有rel="lightbox[gallery]"
),然后它在 Lighbox 中打开,下一个/上一个箭头指向系列中的下一个和上一个图像。我还有一个指向第一张图片并打开图库的文本链接(也带有rel="lightbox[gallery]"
)。
问题是,出于某种原因,该文本链接被计为系列中的图像。因此,当 6 个图像库加载时,它声称有 7 个图像(第一个计数两次)。更重要的是,它加载到 7 个图像 2 上,跳过第一个(无论如何都是重复的)。
如果我删除该文本链接,一切都很好。但是,当然,我不能。那么我的选择是什么?我可以使用 javascript 来启动灯箱(因此链接不算作图库中的图像)吗?无论如何,代码:
<script type="text/javascript" src="lightbox.js"></script>
<!-- THIS IS THE TEXT LINK. NOTE THAT IT IS IDENTICAL TO THE FIRST IMAGE LINK -->
<a href="first.jpg" title="I am image one of three" rel="lightbox[gallery]">View Gallery</a>
<!-- THESE ARE THE GALLERY IMAGES. NOTE THAT THERE ARE 6 OF THEM. WHEN GALLERY LOADS, IT WILL THINK THERE ARE 7 BECAUSE OF THE TEXT LINK ABOVE -->
<a href="first.jpg" title="I am image one of three" rel="lightbox[gallery]"><img src="first_sm.jpg"></a>
<a href="second.jpg" title="I am image two of three" rel="lightbox[gallery]"><img src="second_sm.jpg"></a>
<a href="third.jpg" title="I am image three of three" rel="lightbox[gallery]"><img src="third_sm.jpg"></a>
<a href="fourth.jpg" title="I am image four of three" rel="lightbox[gallery]"><img src="fourth_sm.jpg"></a>
<a href="fifth.jpg" title="I am image five of three" rel="lightbox[gallery]"><img src="fifth_sm.jpg"></a>
<a href="sixth.jpg" title="I am image six of three" rel="lightbox[gallery]"><img src="sixth_sm.jpg"></a>