如何打开一个fancybox窗口(不是onclick) [英] how to just open a fancybox window (not onclick)

查看:111
本文介绍了如何打开一个fancybox窗口(不是onclick)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在触发fancybox打开 onclick ,如下所示:

I am triggering the fancybox to open onclick like this:

$('.telefonosOtrosPaises').fancybox({
                    'type'          :   'iframe',
                    'href'          :   'http://es.solmelia.com/nMenus/jsp/telefonosOtrosPaises.jsp',
                     'transitionIn' : 'elastic',
                    'transitionOut' : 'elastic',
                    /*'easingIn'      : 'easeInOutBack',

                    'easingOut'     : 'easeInOutBack',   */
                     /*onComplete : function(){ $('#fancybox-content').css({'height':'380px','width':'570px','background':'white','padding':'20px'})}*/
                     onComplete : function(){ $('#fancybox-content').css({'width':'630px','background':'white','paddingTop':'15px'})}
});

但是如何在需要时在我的js代码中打开它?

but how can i just open it in my js code when i need it?

推荐答案

不要在元素上调用 .fancybox ,而是这样调用:

Instead of calling .fancybox on an element, call it like this:

$.fancybox.open(...)

注意这是fancybox 2语法,虽然它可能适用于v1

Note this is fancybox 2 syntax, although it might work with v1

如果你想拥有它在 onclick 上打开,当你的代码中出现提示时,只需在你附加的元素上调用点击

If you want to have it open on both onclick and when prompted in your code, just call click on the element you've attached it to.

$('.telefonosOtrosPaises').click();

这篇关于如何打开一个fancybox窗口(不是onclick)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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