我使用dialog()jquery来显示dialogConfirm。它的位置是顶部。我想要中心。 [英] I use dialog() jquery for show dialogConfirm. position of it is left top. I want center.

查看:79
本文介绍了我使用dialog()jquery来显示dialogConfirm。它的位置是顶部。我想要中心。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看下面的代码

look below code

<script src="@Url.Content("~/Scripts/jquery-2.0.3.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")"></script>
    <a href="#" id="deleteArticle" class="lnkDelete">hhhh</a>
     <style>

.ui-dialog-titlebar-close {
  visibility: hidden;
}
</style>
 <script>

     $(document).ready(function () {
         var url = "";
         $("#deleteArticle").click(function (e) {
             e.preventDefault();          
              url = $(this).attr('href');
              $("#dialog-confirm").dialog("open");             
     });

         $("#dialog-confirm").dialog({
             autoOpen: false,
             draggable: false,
             resizable: false,
             height: 200,
             width: 350,      
             show: { effect: "drop", direction: "up" },
            //modal: true,         
            /*open: function (event, ui) {
             $(".ui-dialog-titlebar-close").hide();
         },*/
         buttons: [
                   {
                       text: "yes", click: function () { window.location.href = url; /*$(this).dialog("close");*/ }
                   }
                  ,{
                      text: "no", click: function () {  $(this).dialog("close"); }
                   }
                  ]
             , position: { my: "center", at: "center", of: window}
     });

     });
</script>
<div id="dialog-confirm" style="display: none">
     <p>
        <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
        Are you sure to delete?
     </p>
</div>



我不明白什么问题?


I don't understand what's problem?

推荐答案

(文件).ready(function(){
var url =;
(document).ready(function () { var url = "";


(#deleteArticle)。click(function(e){
e。 preventDefault();
url =
("#deleteArticle").click(function (e) { e.preventDefault(); url =


(this).attr('href');
(this).attr('href');


这篇关于我使用dialog()jquery来显示dialogConfirm。它的位置是顶部。我想要中心。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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