您的所有链接似乎都遵循一种模式:
http://uraniumdrivein.com/img/press/press_web/Ayngel_Overson_BW_web.jpg
http://uraniumdrivein.com/img/press/download/Ayngel_Overson_BW.jpg.zip
http://uraniumdrivein.com/img/press/press_web/Ayngel_Overson_Color_web.jpg
http://uraniumdrivein.com/img/press/download/Ayngel_Overson_Color.jpg.zip
http://uraniumdrivein.com/img/press/press_web/Bette_Nickle_Uravan_web.jpg
http://uraniumdrivein.com/img/press/download/Bette_Nickle_Uravan.jpg.zip
第一个,打开fancybox中的图像(href
属性),第二个下载高分辨率图像(fancybox title
)
您可以做的是使用 javascript方法将打开链接中的 AND 替换为下载链接,例如: press_web
download
_web.jpg
.jpg.zip
replace()
jQuery(document).ready(function ($) {
$(".modal").attr("rel", "gallery").fancybox({
afterLoad: function () {
this.title = this.title ?
'<a href="' + this.href.replace("press_web", "download")
.replace("_web.jpg", ".jpg.zip") +
'">Download</a> ' + this.title
:
'<a href="' + this.href.replace("press_web", "download")
.replace("_web.jpg", ".jpg.zip") +
'">Download</a>';
},
helpers: {
title: {
type: 'inside'
}
}
});
});
见JSFIDDLE