【发布时间】:2011-03-21 17:23:40
【问题描述】:
我有一个普通的 html 页面,其中包含 div 和图片链接等内容:
<div>
<a href="foo.jpg"> ... </a>
<a href="boo.jpg"> ... </a>
</div>
<div>
<a href="bah.jpg"> ... </a>
<a href="gah.jpg"> ... </a>
</div>
...
我正在尝试在所有以 jpg/gif/png 扩展名结尾的链接上挂接灯箱脚本。
现在,根据我之前提出的问题:),我有:
$('div a').filter(function(){
return this.href.match('[\.jpg|\.png|\.gif]$');
}).colorbox({
rel: 'gallery'
});
将gallery内的所有链接分组。
但我想将每个 div 的链接分组到他们自己的画廊中。例如,gallery1 中的 .foo' 和 .boo 链接以及 gallery2 中的 .bah 和 .gah 等等...
我该怎么做?
【问题讨论】:
标签: javascript jquery jquery-selectors lightbox