简体   繁体   English

jQuery对话框的内容仅针对第一个请求对齐

[英]jquery dialog box content aligns only for first request

JSP File JSP文件

 <a  href="#" onclick="pop('terms')> Terms of Use </a>
 | <a  href="#"  onclick="pop('privacy')"> Privacy Policy </a>
 | <a  href="#"  onclick="pop('contact')"> Contact Us / Advertise  


 <div id="dialog"> </div>

JS File JS文件

 function pop(url){
  $("#dialog").dialog({
     modal:true,
     height:450,
     width:600,
     open: function(){
        if(url=="privacy")
        $("#dialog").load('/temp_privacy.jsp');
        if(url=="contact")
            $("#dialog").load('/temp_contact.jsp');
        if(url=="terms")
            $("#dialog").load('/temp_terms.jsp');
    },
       title: url.toUpperCase(),
    close: function(){
        $("#dialog").dialog('destroy');
    }
});

For a First request dialog box opens up with text align at the left , top for every second and subsequent request alignment in dialog box is totally random , I am not able to understand what causes this behavior ? 对于打开的“第一个请求”对话框,其文本左对齐,顶部每秒对齐,随后对话框中的请求对齐完全是随机的,我不明白是什么原因导致了此行为?

without seeing your code, when you load pages like an ajax request your contents css is gettin g overridden somewhere from the rest of your body. 在不查看代码的情况下,当您加载诸如ajax请求之类的页面时,您的内容css将被您身体其余部分覆盖。 make sure all your ids are unique and are not being styled elsewhere even in your jsp files. 确保所有ID都是唯一的,即使在jsp文件中也不要在其他任何地方设置样式。 same with classes make sure they dont have some alt css that is being used by the same class somewhere else in your document 与类相同,请确保它们没有文档中其他地方的同一类正在使用的alt css

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM