2012-05-09 2 views
0

Im используя диалоговое окно, но размер его неправильный - есть ли способ его изменить?Установить размер в диалоговом окне

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

ответ

2

С Jquery Docs, вы можете использовать width и height

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 
      }) 
Смежные вопросы