2011-11-26 72 views

回答

3

這裏的答案: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'; 
    } 
}); 
3

可能這會有所幫助:

$("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; 
      } 
     } 

     });