我想让一些图片可以点击到 Fancybox2 中的网站。我从这个例子中复制了代码:http: //jsfiddle.net/w6p49/
它完全按照我想要的方式工作,只是我使用的是标题而不是标题。我从这里复制了代码:http: //jsfiddle.net/vkDcG/
我的代码
//Launch website URLS
$("#client-url").click(function() {
$.fancybox.open([
{
href: 'http://xyz.com/images/portfolio/brand/client3/01.jpg',
link: 'http://www.clientwebsite.com'
},
{
href: 'http://xyz.com/images/portfolio/brand/client3/02.jpg',
link: 'http://www.clientwebsite.com'
},
{
href: 'http://xyz.com/images/portfolio/brand/client3/03.jpg',
link: 'http://www.clientwebsite.com'
},
{
href: 'http://xyz.com/images/portfolio/brand/client3/04.jpg',
link: 'http://www.clientwebsite.com'
},
],
{
beforeShow: function() {
$(".fancybox-image").wrap('<a a target="_blank" href="' + this.link + '" />')
},
/*Use caption attribute instead of title*/
beforeLoad: function () {
this.title = $(this.element).attr('caption');
},
/*Fade image transition instead of default "elastic"*/
openEffect: 'fade',
closeEffect: 'fade',
nextEffect: 'fade',
prevEffect: 'fade',
/*Hide the prev button on the first image, and the next button on the last one.*/
loop: false
});
return false;
});
一切正常,只是没有显示字幕。任何帮助将不胜感激。