Art*_*dad 3 jquery helper thumbnails button fancybox
我需要同时使用它们(fancybox按钮助手和缩略图助手)
我一次只能使用其中一个.
以下是每个功能的示例:http: //fancyapps.com/fancybox/#examples
已经尝试过使用这两个类:
<a class="fancybox-buttons fancybox-thumbs"
Run Code Online (Sandbox Code Playgroud)
但它不起作用......一次只有一个,如:
<a class="fancybox-buttons"
Run Code Online (Sandbox Code Playgroud)
要么
<a class="fancybox-thumbs"
Run Code Online (Sandbox Code Playgroud)
.
这些是每个的javascripts:
/*
Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
/*
Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
$('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
谢谢
你只需要一个脚本就可以使用这两个脚本,所以class
你html
应该使用单个脚本
<a class="fancybox" ...
Run Code Online (Sandbox Code Playgroud)
然后脚本:
$('.fancybox').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
title : {
type : 'inside'
},
buttons : {},
thumbs : {
width : 50,
height : 50
}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
Run Code Online (Sandbox Code Playgroud)