回发期间JQuery插件fancybox问题 [英] JQuery plugin fancybox problem during postback
问题描述
我正在使用这个Fancy box插件显示一个灯箱,用于确认删除功能。
I am using this Fancy box plugin to display a light box for confirm delete functionality.
function fancyConfirm(msg, callback)
{
var ret;
jQuery.fancybox({
modal: true,
// content: "<div style=\"margin:1px;width:240px;\">" + msg + "<div style=\"text-align:right;margin-top:10px;\"><input id=\"fancyConfirm_cancel\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Cancel\"><input id=\"fancyConfirm_ok\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Unfollow\"></div></div>",
content: "<div id=\"unfollower\"><div><table class=\"light_marg\"><thead><tr><td colspan=\"2\">Unfollow Project</td></tr></thead><tbody><tr><td colspan=\"2\">Are you sure you want to unfollow this project?</td></tr><tr><td></td><td><input id=\"fancyConfirm_ok\" class=\"btn btn-primary btn-large\" type=\"button\" value=\"Unfollow\"><input id=\"fancyConfirm_cancel\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Cancel\" class=\"btn btn-primary btn-large\"> </td></tr></tbody></table></div></div>",
afterShow: function()
{
$("#fancyConfirm_cancel").click(function()
{
ret = false;
jQuery.fancybox.close();
})
jQuery("#fancyConfirm_ok").click(function()
{
ret = true;
jQuery.fancybox.close();
})
},
afterClose: function()
{
if (typeof callback == 'function')
{
callback.call(this, ret);
}
}
// function()
// {
// callback.call(this, ret);
// }
});
}
function fancyConfirm_text()
{
var src ;
fancyConfirm("Are you sure you want to unfollow this project?", function(ret)
{
alert((ret));
// alert(src+'-'+ret);
src= ret;
});
这是我在asp.net上的按钮点击代码
This is my on button click code on asp.net
<asp:LinkButton ID="LnkBtnUnfollow" runat="server" CommandArgument ='<%# Eval("item_id")%>' OnClick="delete" OnClientClick="return fancyConfirm_text(); " class="draft_link_tabs_but">Unfollow</asp:LinkButton>
因此,当我尝试删除特定行时,页面显示确认的灯箱我单击是/否但页面不执行回发它是因为我放回false。
So when i try to delete the particular row the page displays the light box for the confirmation i click yes/No but the page does not perform postback it is because i placed return false .
推荐答案
( #fancyConfirm_cancel)。click(function()
{
ret = false ;
jQuery.fancybox.close();
})
jQuery( #fancyConfirm_ok)。点击(function()
{
ret = true ;
jQuery.fancybox.close();
})
},
afterClose:function()
{
if ( typeof callback == ' function')
{
callback.call( this ,ret);
}
}
// function()
// {
// callback.call(this,ret);
// }
});
}
函数fancyConfirm_text()
{
var src;
fancyConfirm( 你确定要取消关注这个项目吗?,function(ret )
{
alert((ret));
// alert(src + ' - '+ ret);
src = ret;
});
("#fancyConfirm_cancel").click(function() { ret = false; jQuery.fancybox.close(); }) jQuery("#fancyConfirm_ok").click(function() { ret = true; jQuery.fancybox.close(); }) }, afterClose: function() { if (typeof callback == 'function') { callback.call(this, ret); } } // function() // { // callback.call(this, ret); // } }); } function fancyConfirm_text() { var src ; fancyConfirm("Are you sure you want to unfollow this project?", function(ret) { alert((ret)); // alert(src+'-'+ret); src= ret; });
这是我在asp.net上的按钮点击代码
This is my on button click code on asp.net
<asp:LinkButton ID="LnkBtnUnfollow" runat="server" CommandArgument ='<%# Eval("item_id")%>' OnClick="delete" OnClientClick="return fancyConfirm_text(); " class="draft_link_tabs_but">Unfollow</asp:LinkButton>
因此,当我尝试删除特定行时,页面显示确认的灯箱我单击是/否但页面不执行回发它是因为我放回false。
So when i try to delete the particular row the page displays the light box for the confirmation i click yes/No but the page does not perform postback it is because i placed return false .
这篇关于回发期间JQuery插件fancybox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!