jQuery的对话框仅是第一次出现奇怪的行为 [英] Jquery 's dialog strange behaviours for first time only

查看:88
本文介绍了jQuery的对话框仅是第一次出现奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用jQuery对话框.我正在使用下面的函数对其进行初始化.

I am using jQuery dialog in my application. and i am using below function to initialize it.

$searchApplianceDialog = $('#divSearchAppliance')
                            .load('job/searchAppliance.jsp', function() {
                            })
                            .dialog(
                                    {
                                        autoOpen : false,
                                        resizable : false,
                                        draggable : false,
                                        modal : true,
                                        title : ' Search Appliance',
                                        width : 850,
                                        open : function() {
                                            $('#searchApplianceApplianceNumber').focus();

                                            resetApplianceSearch("#applianceList",'Link.do?method=searchJobOrderAppliance&showBlank=true','#frmApplianceSearch');

                                                                                    },
                                        beforeClose : function() {
                                        },
                                        close : function() {
                                            $('#searchApplianceButton').focus();
                                        }
                                    }); // ends search appliance    

当我第一次使用它打开时

when i first open it using

$searchApplianceDialog.dialog('open'); 

它已打开,但仅在第一次时就产生了定位自身的问题.相对于页面宽度,它正确地将其自身定位在页面的中心,但是相对于页面高度,它在y轴上的位置为-20,这是第一次,每次正确定位之后.

it is opened but it creates a problem of positioning itself for first time only . it positions itself correctly in the center of the page with reference to page width but with reference to page height it positioned -20 for y axis and this is only for first time , after every time it gets positioned correctly.

解决方案是什么?

推荐答案

尝试将其放在后面

$(document).ready(function(){ 

这篇关于jQuery的对话框仅是第一次出现奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆