Jquery ui 为什么我的jquery对话框不能完全淡出()?
当我在对话框中调用淡出时,它只会部分淡出,并留下对话框标题所在的灰色标题区域。我尝试过删除标题以及禁用对话框右上角“退出”按钮的各种属性,但没有成功。正如您将在下面的脚本中看到的,我希望在表单提交经过验证后关闭对话框Jquery ui 为什么我的jquery对话框不能完全淡出()?,jquery-ui,jquery-ui-dialog,Jquery Ui,Jquery Ui Dialog,当我在对话框中调用淡出时,它只会部分淡出,并留下对话框标题所在的灰色标题区域。我尝试过删除标题以及禁用对话框右上角“退出”按钮的各种属性,但没有成功。正如您将在下面的脚本中看到的,我希望在表单提交经过验证后关闭对话框 //HTML <div id="dialog"> <form id="form"> <p id="thanks">Please provide a contact number. It will only be
//HTML
<div id="dialog">
<form id="form">
<p id="thanks">Please provide a contact number. It will only be shared with the
host</p><input id="number" name="number" type="text"/>
<button id="submit" type="submit">Submit</button>
</form>
</div>
//JS
if(myConditional){
//FORM IS HIDDEN ON PAGE LOAD AND SHOWN ON CLICK
$('form').show();
$('#dialog').dialog({
//These parameters are meant to disable the dialog close button
closeOnEscape: false,
beforeclose: function (event, ui) { return false; },
dialogClass: "noclose",
title: "Thanks For Volunteeering",
minWidth: 500
});
$('button').button();
}else{
//other code
}
//Validate the phone number before saving it to local storage
$("#form").validate({
rules: {
number : {
required: true
customvalidation: true
}
},
messages: {
number : {
required: "enter a phone number"
}
},
submitHandler: function(form) {
var number = $('#number').val();
localStorage.setItem('number', JSON.stringify(number));
//THIS FADE OUT ISN'T FULLY FADING THE DIALOG
$('#dialog').fadeOut();
} //closes submit handler
});//close validate
好吧,我知道了。
我在对话框初始化代码中去掉了beforeClose参数,并在表单验证提交处理程序中添加了以下内容:
$('#dialog').fadeOut('slow', function(){
$( this ).dialog( "close" );
});
//The fadeOut method has a call back function you can use with it to do something after the fade is completed.
尝试删除“$”表单。显示`我试过了,但仍然有问题。控制台中有错误吗?apache控制台中没有任何相关错误,没有。我指的是javascript控制台。不管怎样,你的错误现在看来已经解决了。