在Fancybox弹出框打开时添加按钮点击事件 [英] Adding button click event when Fancybox popup opened

查看:582
本文介绍了在Fancybox弹出框打开时添加按钮点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在使用以下代码加载Fancybox弹出式窗口时向按钮标记添加按钮onclick事件:

  var processOrder = function(id){
$('#processPopupLink')。fancybox({
'hideOnContentClick':false,
'frameWidth':850,
' frameHeight':695
})。click();

$('#processComplete')。click(function(){
alert('debug');
});
}

但是,当我点击按钮时没有显示消息框




p>我不想让它点击按钮,我希望它添加一个现有的按钮在fancybox弹出窗口,当fancybox弹出时打开。

解决方案

Fancybox API


onComplete - 显示
内容时将调用。




  $('#processPopupLink')。fancybox({
onComplete:function(){
$('#processComplete')。 ()
{
alert('debug');
});
}
});


I'm trying to add a button onclick event to a button tag when I load my Fancybox popup using the following code:

var processOrder = function(id) {
    $('#processPopupLink').fancybox({
        'hideOnContentClick': false,
        'frameWidth': 850,
        'frameHeight': 695
    }).click();

    $('#processComplete').click(function() {
        alert('debug');
    });
}

However, it's not showing the message box when I click the button, I have no idea why it is not working, any help would be appreciated.

EDIT

I'm not wanting it to click the button, I'm wishing for it to add an onclick to an existing button on the fancybox popup, when the fancybox popup is opened.

解决方案

From the Fancybox API:

onComplete - Will be called once the content is displayed.

$('#processPopupLink').fancybox({
    onComplete: function() { 
        $('#processComplete').click(function() 
            {
               alert('debug');
            }); 
    }
});

这篇关于在Fancybox弹出框打开时添加按钮点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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