开发者

Fancybox - declaring size in link

Due to the system i'm having to build a site in templates are extremely restrictive so I don't have much control.

My question is:

Is it possible with fancybox to set the width and height in the link?

e.g.

<a href="iframelocation" class="fancybox 480 320">C开发者_如何学运维lick here"</a>

Thanks in advance.

PVS


You could store the values in data- attributes. (assuming you are using jQuery 1.4.3 or greater)

<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
   });
});


I'd recommend using HTML5 data-* attributes.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜