【问题标题】:Fancybox closing when post back occurs回发时关闭 Fancybox
【发布时间】:2011-09-10 02:47:24
【问题描述】:

我有一个 asp.net 应用程序,其模态幻想框设置为 iframe。我有一个扫描信用卡的过程,一旦扫描发生,fancybox 就会消失。我可以通过简单地按回车键来重现这一点。因此,回发似乎导致fancybox关闭。

我尝试了几件事,但似乎没有任何效果。这是fancybox的原始加载方式:

$.fancybox({
    'modal': true,
    'width': '100%',
    'height': 1300,
    'padding': 5,
    'autoScale': false,
    'transitionIn': 'elastic',
    'transitionOut': 'elastic',
    'type': 'iframe',
    'href': storeUrl,
    'title': 'Welcome to the Store',
    'titlePosition': 'over',
    'onStart': function ()
    {
        openSF();
    },
    'onClosed': function ()
    {
        closedSF();
    }
});

【问题讨论】:

    标签: c# asp.net iframe fancybox


    【解决方案1】:

    尝试将 iframe 中的表单绑定到 jquery 函数以捕获正在发生的任何帖子。我们在工作中使用条形码扫描仪,每次扫描都会返回字符,以及提交表单的 CRLF。这可能发生在信用卡扫描仪上。

    $('#MyFormId').bind('submit', function () { 
    
        //Optional code to run after credit card scanned
    
        return false;   //Ensures form never actually "posts" - just stays on this page 
    }); 
    

    【讨论】:

    • 我尝试在内容块中添加上面的代码,但它并没有停止回发。我还有什么需要做的吗?
    猜你喜欢
    • 2012-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多