2011-03-21 3 views
1

시스템으로 인해 템플릿에 사이트를 구축해야하기 때문에 매우 제한적이어서 많은 제어 권한이 없습니다.Fancybox - 링크의 크기 선언

내 질문은 :

는 링크 폭과 높이를 설정 fancybox에 수 있습니까?

사전에

<a href="iframelocation" class="fancybox 480 320">Click here"</a>

감사합니다.

PVS

답변

5

당신은 data- 속성의 값을 저장할 수 있습니다.

<a href="iframelocation" class="fancybox" data-width="480" data-height="320">Click here"</a> 

$("a.fancybox").each(function(){ 
    var $a = $(this); 
    var h = $a.data("height") 
    var w = $a.data("width"); 
    $a.fancybox({ 
      'width' : w, 
      'height': h 
    }); 
}); 
+0

jQuery는 자동으로'data- *'속성을 구문 분석합니까? –

+0

jQuery 1.4.3 이상을 사용하는 한 오래 유지됩니다. –

+0

이 원리는 저에게 효과가 있습니다! –

2

나는 HTML5 data-* attributes를 사용하는 것이 좋습니다 것 (당신이 jQuery를 1.4.3 이상을 사용하는 가정).

<a href="iframelocation" class="fancybox" data-width="480" data-height="320">Click here"</a>