对于v2.1.5,您可以通过使用html元素的ID来使用。
<a id="item1" class="fancybox" href="http://fiddle.jshell.net/YtwCt/show/">Open 500x200</a>
<br />
<a id="item2" class="fancybox" href="http://fiddle.jshell.net/YtwCt/show/">Open 200x500</a>
<div id="test" style="display:none">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce pulvinar, nulla eu interdum posuere, nisi mauris cursus nisi, nec faucibus nibh urna nec turpis.
$(".fancybox-wrap").draggable();
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
type: 'iframe',
autoSize : false,
beforeLoad : function() {
if ($(this.element).attr('id') == 'item1') {
this.width = 500;
this.height = 200;
}
else {
this.width = 200;
this.height = 500;
}
}
});