0
我正在与fancybox功能。它工作正常,但它不基于我的Rel。分组Fancybox图像
这里是javascipt的
<script type="text/javascript">
$(function($){
var addToAll = false;
var gallery = true;
var titlePosition = 'inside';
$(addToAll ? 'img' : 'img.fancybox').each(function(){
var $this = $(this);
var title = $this.attr('title');
var src = $this.attr('data-big') || $this.attr('src');
var a = $('<a href="#" class="fancybox"></a>').attr('href', src).attr('title', title);
$this.wrap(a);
});
if (gallery)
$('a.fancybox').fancybox({
titlePosition: titlePosition
});
});
$.noConflict();
</script>
HTML
<img class="fancybox" title="Bed" rel="1roomGD" src="images_1" alt="Bed" />
<img class="fancybox" title="K" rel="1roomGD" src="images_2" alt="K" />
<img class="fancybox" title="G" rel="2roomS" src="images_3" alt="G" />
你不应该绑定的fancybox到''但''标签。你也可以查看这个http://stackoverflow.com/a/9487189/1055987以供参考 – JFK