Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Fancybox中的Target href_Javascript_Jquery_Fancybox_Fancybox 2 - Fatal编程技术网

Javascript Fancybox中的Target href

Javascript Fancybox中的Target href,javascript,jquery,fancybox,fancybox-2,Javascript,Jquery,Fancybox,Fancybox 2,我正在尝试在标题中放置一个链接,它基本上是选定的锚href,带有前缀。我怎样才能做到以下几点?我希望能够在选定的锚元素上获取this.href $(".gallery-module > li > a").fancybox( { title : '<a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi' }); $(“.gall

我正在尝试在标题中放置一个链接,它基本上是选定的锚href,带有前缀。我怎样才能做到以下几点?我希望能够在选定的锚元素上获取this.href

$(".gallery-module > li > a").fancybox(
{
    title       : '<a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi'
});
$(“.gallery module>li>a”).fancybox(
{
标题:“
高分辨率文件,300dpi” });
绑定fancybox时:

$(".gallery-module > li > a").fancybox({
    title: '<a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi'
});

$('.gallery module>li>a')中。每个
回调,
这个
将是您要查找的

我假设您使用的是fancybox v1.3.x,不是吗

对于该版本,您不能直接引用
this.href
,除非它位于回调函数中。在您的情况下,您可以使用
titleFormat
选项自定义标题,如

$(".gallery-module > li > a").fancybox({
 titleFormat: function(){
  return '<div class="newTititleWrap"><a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi</div>'
 } 
});

我将发布v1.3.4版的解决方案,以防它对其他人有所帮助。

问题出在哪里,出在哪里?您有我们可以看到并使用的解决方案吗?那么,您的问题解决了吗?对提供的答案有任何反馈吗?你是对的,我错过了标签“fancybox-2”(我的错)。。。将编辑答案。
$(".gallery-module > li > a").fancybox({
 titleFormat: function(){
  return '<div class="newTititleWrap"><a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi</div>'
 } 
});
 $(".gallery-module > li > a").fancybox({
   beforeShow : function() {
    this.title = '<div class="newTititleWrap"><a href="'+ this.href + '-large">DOWNLOAD</a><br> High Resolution File, 300dpi</dv>';
   } 
 }); // fancybox