如何定位jquery ui窗口?

发布于 2024-12-13 10:19:43 字数 1197 浏览 5 评论 0原文

我尝试了位置,但对话框一直显示到右侧,我调整了数字,但显示没有变化:

 $("#div_").dialog("wid").position({ position: [10, 50]}); 

END UPDATE

这是我的 html 代码,在下面呈现,

radio button1   sample 
radio button2   sample 
radio button3   sample 

所以我想要的是:用户将鼠标悬停在“示例”上,显示链接下方的 jquery-ui,

它适用于第一个链接,但第二个链接显示在屏幕中间,即使我分配了 left, top,有什么帮助吗?

$(document).ready(function () { 

$('#div_').dialog({ 
autoOpen: false, 
}); 

$(".radiobutton1").hover( 
function (){ 
$('#div_').dialog({title: "Iamge Left)"}); 
$('#div_').removeClass("radiobutton1_1 radiobutton2").dialog('open'); 
var target = $(this); 
$("#div_").dialog("wid").position({ 
my: 'left top', 
at: 'center bottom', 
of: target 
}); 
}, 
function (){ 
$('#div_').dialog('close'); 
}); 

$(".radiobutton2").hover( 
function (){ 
$('#div_').dialog({title: "Images Right"}); 
$('#div_').removeClass("radiobutton1_1 radiobutton2").addClass("radiobutton2").dialog('open'); 
 var target = $(this); 

$("#div_").dialog("wid").position({ 
my: 'center top' 
at: 'center bottom', 
of: target 
}); 
}, 
function (){ 
$('#div_').dialog('close'); 
}); 
}); 

i tried with position but the dialog shows all the way to the right side and i tweak with numbers but no change in displaying:

 $("#div_").dialog("wid").position({ position: [10, 50]}); 

END UPDATE

here is my html code that renders below

radio button1   sample 
radio button2   sample 
radio button3   sample 

so what i want is: when the user hover over the "Sample" show the jquery-ui underneath the link

its working for the first link but the second link its showing in middle of the screen, even thoug i have left, top assigned, any help?

$(document).ready(function () { 

$('#div_').dialog({ 
autoOpen: false, 
}); 

$(".radiobutton1").hover( 
function (){ 
$('#div_').dialog({title: "Iamge Left)"}); 
$('#div_').removeClass("radiobutton1_1 radiobutton2").dialog('open'); 
var target = $(this); 
$("#div_").dialog("wid").position({ 
my: 'left top', 
at: 'center bottom', 
of: target 
}); 
}, 
function (){ 
$('#div_').dialog('close'); 
}); 

$(".radiobutton2").hover( 
function (){ 
$('#div_').dialog({title: "Images Right"}); 
$('#div_').removeClass("radiobutton1_1 radiobutton2").addClass("radiobutton2").dialog('open'); 
 var target = $(this); 

$("#div_").dialog("wid").position({ 
my: 'center top' 
at: 'center bottom', 
of: target 
}); 
}, 
function (){ 
$('#div_').dialog('close'); 
}); 
}); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聊慰 2024-12-20 10:19:43

是的,但第二次你有这个:

my: 'center top' 

会是

my: 'left top' 

Yeah but for the second you have this :

my: 'center top' 

Would be

my: 'left top' 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文