Fancybox 2.0标题选项

问题描述:

在Fancybox 1.3.4有标题选项,如TitlePositionTitleFormat。是否有替代这些选项?Fancybox 2.0标题选项

感谢

其在2.0也是相同的,检查出的API:http://fancybox.net/api

这里的答案:Fancybox v2 override/format title

您需要使用beforeLoad()函数加载自定义标题元素 -

$(".fancybox").fancybox({ 
    openEffect : 'elastic', 
    openEasing : 'easeOutBack', 

    closeEffect : 'elastic', 
    closeEasing : 'easeInBack', 

    helpers : { 
     title : { 
      type : 'inside' 
     } 
    }, 
    beforeLoad : function() { 
     this.title = 'My Custom Title'; 
    } 
}); 

可能这会有所帮助:

$("a[rel=group]").fancybox({ 
      openEffect  : 'fade', 
      closeEffect  : 'fade', 
      nextEffect  : 'fade', 
      prevEffect  : 'fade', 
      helpers : { 
       title : { 
        type : 'inside' 
       } 

      }, 
      beforeShow : function(opt) { 
      if(this.element.title==''){ 
       this.element.title='Image '+ (this.index + 1) + '/' + this.group.length; 
       this.title=this.element.title; 
      } 
     } 

     });