我在对话框中创建了一个带有ajax加载调用的对话框。我试图在对话框中放置一个html表,但是当我加载页面时,html表显示在它应该位于下方的位置,位于页面顶部。如何让HTML表格显示在对话框的顶部?
$("#subscribe").button().on( "click", function() {
$( "<div id='subscription_d' title='Please Enter Your Details'></div>" ).dialog({
width:400,
height:250,
autoOpen: true,
resizable: true,
modal: true,
open: function(event, ui) {
$('#subscription_d').load("ajax.php?action=subscribe_form", function (){
$(this).find('button').button();
});
},
});
});
然后调用ajax.php文件,代码为:
<?php
switch ($_GET['action']){
case 'subscribe_form':
$html = '';
$html .= '<form id="formsignup">
<table border="1">
<tr>
<td>(something here)</td>
</tr>
</table>
</form>';
echo $html;
break;
default:
}
?>
答案 0 :(得分:0)
尝试使用dialogClass和position参数,如果还没有。
$( "<div id='subscription_d' class='mydialog' title='please Enter Your Details'></div>" )
.dialog({
width:400,
height:250,
autoOpen: true,
resizable:true,
modal:true,
dialogClass: "mydialog",
position: { my: "left top+50 " , of :"#subscribe" },
open: function(event, ui) {
$('#subscription_d').load("ajax.php?action=subscribe_form", function(){
$(this).find('button').button();
});
}
});
.mydialog {
border : 1px solid #555;
float : left;
z-index: 10;
}