2012-01-21 5 views
3

나는 simultaniously (fancybox 버튼 도우미 및 썸네일 도우미)fancybox button helper + fancybox thumbnail helper 사용 방법?

내가 한 번에 그 중 하나를 사용할 수 있습니다를 둘 다 사용해야합니다. http://fancyapps.com/fancybox/#examples

이미 두 클래스 사용하여 시도 : 같은 시간에

<a class="fancybox-buttons fancybox-thumbs"  

그러나이 작동하지 않습니다 ... 하나,

각 기능의 예입니다 :

<a class="fancybox-buttons"  

또는

<a class="fancybox-thumbs"  

.

각각의 자바 스크립트입니다 :

  /* 
      Button helper. Disable animations, hide close button, change title type and content 
     */ 

     $('.fancybox-buttons').fancybox({ 
      openEffect : 'none', 
      closeEffect : 'none', 

      prevEffect : 'none', 
      nextEffect : 'none', 

      closeBtn : false, 

      helpers : { 
       title : { 
        type : 'inside' 
       }, 
       buttons : {} 
      }, 

      afterLoad : function() { 
       this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); 
      } 
     }); 


     /* 
      Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked 
     */ 

     $('.fancybox-thumbs').fancybox({ 
      prevEffect : 'none', 
      nextEffect : 'none', 

      closeBtn : false, 
      arrows : false, 
      nextClick : true, 

      helpers : { 
       thumbs : { 
        width : 50, 
        height : 50 
       } 
      } 
     }); 

    });  

감사

에만처럼 작동합니다 귀하의 html의 단일 class에 모두 있도록 사용하는 하나의 스크립트를 필요로
+1

JFK 답변이 훌륭하게 작동합니다! –

+0

http://meta.stackexchange.com/a/5235 – JFK

답변

8

<a class="fancybox" ... 

스크립트 :

$('.fancybox').fancybox({ 
openEffect : 'none', 
closeEffect : 'none', 
prevEffect : 'none', 
nextEffect : 'none', 
closeBtn : false, 
arrows : false, 
nextClick : true, 
helpers : { 
    title : { 
    type : 'inside' 
    }, 
    buttons : {}, 
    thumbs : { 
    width : 50, 
    height : 50 
    } 
}, 
afterLoad : function() { 
    this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); 
} 
}); 
+1

감사합니다 !! 나는 빨리 형제 할 것이다. –