在对话框上设置大小

时间:2012-05-09 07:52:17

标签: c# asp.net-mvc-3 dialog

我正在使用一个对话框,但它的大小不正确有没有办法改变它?

     <script type="text/javascript">

     $.ajaxSetup({ cache: false });

     $(document).ready(function () {
         $(".openDialog").live("click", function (e) {
             e.preventDefault();


             $("<div></div>")
                .addClass("dialog")
                .attr("id", $(this)
                .attr("data-dialog-id"))
                .appendTo("body")
                .dialog({
                    title: $(this).attr("data-dialog-title"),
                    close: function () { $(this).remove() },

                    modal: true
                })

                .load(this.href);
         });

         $(".close").live("click", function (e) {
             e.preventDefault();
             $(this).closest(".dialog").dialog("close");
         });
     });
</script>

1 个答案:

答案 0 :(得分:2)

在jquery文档中,您可以使用widthheight

http://docs.jquery.com/UI/Dialog

  

对话框的高度,以像素为单位。指定'auto'也是   支持根据内容调整对话框。

.dialog({height:
  

对话框的宽度,以像素为单位。

.dialog({height:

 $.ajaxSetup({ cache: false });

 $(document).ready(function () {
     $(".openDialog").live("click", function (e) {
         e.preventDefault();


         $("<div></div>")
            .addClass("dialog")
            .attr("id", $(this)
            .attr("data-dialog-id"))
            .appendTo("body")
            .dialog({
                width:yourValueHere,//Put width
                height:yourValueHere,//Put height
                title: $(this).attr("data-dialog-title"),
                close: function () { $(this).remove() },

                modal: true
            })
相关问题