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>
精彩评论