请教一下,我有一个JQueryUI Dialog,显示的时候要放在一个<Input type="text">的下面,请教大家一下,怎么定位,我定位了都会偏了一点。
$("#TimeSelect").dialog({
autoOpen: false,
width:250,
height:200,
buttons: {
"确定": function() {
$( this ).dialog( "close" );
$("#txTime").val($("#spanHour").text() + ":" + $("#spanMin").text())
},
"取消": function() {
$( this ).dialog( "close" );
}
}
});
$("#txTime").click(function(){
$("#TimeSelect").dialog("option","position",[$("#txTime").offset().left,$("#txTime").offset().top+$("#txTime").height()+5]);
$("#TimeSelect").dialog( "open" );
//alert($("this").outerHeight + "px");
});<input type="text" name="txTime" id="txTime" />
初始定位OK,如果有滚动条的时候位置就会出错,请问有什么办法可以定位好。
$("#TimeSelect").dialog({
autoOpen: false,
width:250,
height:200,
buttons: {
"确定": function() {
$( this ).dialog( "close" );
$("#txTime").val($("#spanHour").text() + ":" + $("#spanMin").text())
},
"取消": function() {
$( this ).dialog( "close" );
}
}
});
$("#txTime").click(function(){
$("#TimeSelect").dialog("option","position",[$("#txTime").offset().left,$("#txTime").offset().top+$("#txTime").height()+5]);
$("#TimeSelect").dialog( "open" );
//alert($("this").outerHeight + "px");
});<input type="text" name="txTime" id="txTime" />
初始定位OK,如果有滚动条的时候位置就会出错,请问有什么办法可以定位好。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货