当我单击“.fancybox-button”时,如何打开与“.fancybox”打开的同一个画廊,同时保持相同的精美框设置?
<div class="custom-thumbnail"><a class="fancybox" rel="group" href="Gallery/Image3.jpg"><img title="Bird Caption" src="Gallery/_t/testImage3_jpg.jpg"></a></div>
<div class="custom-caption"><a class="fancybox-button" rel="fancybox-button" href="Gallery/testImage3.jpg">Click here to open gallery</a></div>
这是我管理 fancybox 属性的代码
jQuery(".fancybox").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '100%',
height : '100%',
title: this.title,
wmode: 'transparent',
allowfullscreen : 'true',
allowscriptaccess : 'always',
beforeLoad: function() {
this.title = jQuery(this.element).find('img').attr('title');
},
next : {
13 : 'left', // enter
34 : 'up', // page down
39 : 'left', // right arrow
40 : 'up' // down arrow
},
prev : {
8 : 'right', // backspace
33 : 'down', // page up
37 : 'right', // left arrow
38 : 'down' // up arrow
},
close : [27], // escape key
helpers: {
title : {
type : 'inside' // 'float', 'inside', 'outside' or 'over'
},
overlay : {
showEarly : false
},
thumbs : {
width: 50,
height: 50
}
}
});
最佳答案
这对我有用。你们觉得这个解决方案怎么样?
jQuery('.fancybox-button').click(function(){
jQuery(this).parent().prev().find('.fancybox').trigger('click');
return false;
});
关于jquery - FancyBox 从多个链接打开同一个画廊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30087856/