Fancybox-在链接中声明大小 [英] Fancybox - declaring size in link

查看:113
本文介绍了Fancybox-在链接中声明大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于系统的原因,我不得不在模板中构建站点非常严格,因此我没有太多控制权.

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

我的问题是:

fancybox是否可以在链接中设置宽度和高度?

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

例如

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

提前谢谢.

PVS

推荐答案

您可以将值存储在data-属性中. (假设您使用的是jQuery 1.4.3或更高版本)

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

这篇关于Fancybox-在链接中声明大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆