简体   繁体   中英

Set size on Dialog box

Im using an dialog box, but the size of it is not right is there any way to change it?

     <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>

From the jquery docs, you can use width and height

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

The height of the dialog, in pixels. Specifying 'auto' is also supported to make the dialog adjust based on its content.

.dialog({height:

The width of the dialog, in pixels.

.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
            })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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