2014-03-26 50 views
0

我在应用程序中使用JQuery Popup Overlay。它运作良好,但有问题。在页面加载时,它会弹起并消失。我尽力而为,但无法弄清楚。你能帮忙吗?jquery弹出覆盖页面加载页面?

这里是我的代码:

型号的标记:

 <div aria-hidden="true" aria-labelledby="standardModalLabel" role="dialog" tabindex="-1" 
    id="confirm_password"> 
     <div id="" class="modal-dialog" > 
     <div class="modal-content"> 
      <div class="modal-header" id="TSPopUpHeader"> 
       <button aria-hidden="true" data-dismiss="modal" onclick="javascript:ClosePasswordPopUp();" 
        class="close" type="button"> 
        ×</button> 
       <h4 id="TSPasswordPopUpHeading" class="modal-title"> 
        Confirmation</h4> 
      </div> 
      <div class=""> 
       <p class="PasswordPopUpBody" id="TSPasswordPopUpBody"> 
        Please enter password to confirm&nbsp;&nbsp; 
        <%=Html.Password("password", null, new { @class = "form-control", @style = "width:50%;", @id = "password" })%> 
        <span id="error_message" class="PasswordErrorMessageDiv" style="visibility: hidden;"> 
        </span> 
       </p> 
      </div> 
      <div class="modal-footer" id="TSPopUpFooter"> 
       <input type="button" id="password_ok" value="Ok" class="btn btn-green" /> 
       &nbsp; 
       <input type="button" id="password_cancel" onclick="javascript:ClosePasswordPopUp();" 
        class="btn btn-green" value="Cancel" /> 
      </div> 
     </div> 
    </div> 
</div> 

Java脚本代码:

$(document).ready(function() { 

     $("#confirm_password").popup(
     { 
      focuselement: "#password" 
     }); 

     $("#confirm_password").popup('hide'); 
} 
+0

什么版本的jquery库弹出()从? – Siva

+0

@Siva它是jQuery v1.7.2,请任何帮助 – Toubi

+0

我在以下http://jsfiddle.net/siva_hari/BC5sz/中使用jQueryUI对话框我无法在jquery中找到弹出方法出于某种原因。 – Siva

回答

1

正如你说你正在使用 “的JQuery弹出叠加”,与你的标记风格我假设你正在使用Vast-engineering之一。

弹出式弹起是因为它在您为文档准备提供的代码中清晰可见,因此在此之后启动并隐藏。

我建议你在实施之前先通过插件的文档,好像你已经声明It works good,但我非常怀疑看着你的标记,这些标记在某些地方不符合要求。

那么,对于您的问题,您不应该使用隐藏调用来启动它,而应该使用其autoopen选项来调用它。

$(document).ready(function() { 
     $("#confirm_password").popup(
     { 
      autoopen: true, 
      focuselement: "#password" 
     }); 
} 

如果您进一步提供演示,将很容易排除故障。