javascript JQuery Fancybox 表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15601463/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:22:00  来源:igfitidea点击:

JQuery Fancybox Form

javascriptjqueryhtmlcssfancybox

提问by Andrue

I've recently started learning JQuery, and I'm doing fine with it. Though, I'm using FancyBoxand I'm having some trouble.

我最近开始学习 JQuery,而且我做得很好。不过,我正在使用FancyBox并且遇到了一些麻烦。

I want to display a form inside a <div>rather than an iframe. I'm not sure how to display a <div style="display: hidden;">with FancyBox.

我想在 a<div>而不是 iframe 中显示一个表单。我不确定如何<div style="display: hidden;">使用 FancyBox显示 a 。

http://jsfiddle.net/nLcMh/21/

http://jsfiddle.net/nLcMh/21/

I have the form inside a hidden div tag and I want to use FancyBox to display it. Fancybox is a type of JQuery lighbox.

我在隐藏的 div 标签中有表单,我想使用 FancyBox 来显示它。Fancybox 是一种 JQuery 灯箱。

回答by hyde

if you need something with more options try this fiddle:

如果您需要更多选项,请尝试使用此小提琴:

$("a.openform").click(function () {
        $.fancybox(
                $('.form').html(),
                {
                    'width'             : 950,
                    'height'            : 1100,
                    'autoScale'         : false,
                    'transitionIn'      : 'none',
                    'transitionOut'     : 'none',
                    'hideOnContentClick': false,
                    'onStart': function () {
                      //On Start callback if needed  
                    }
                 }
            );
    });

http://jsfiddle.net/RQQ5r/1/

http://jsfiddle.net/RQQ5r/1/

回答by aNewStart847

Updated fiddle: http://jsfiddle.net/nLcMh/28/
Changed link to <a href="#form" class="openform">See Form</a>

更新小提琴:http: //jsfiddle.net/nLcMh/28/
将链接更改为<a href="#form" class="openform">See Form</a>