2012-10-21 15 views
1

我在我的頁面,iframe中有iframe我有一個按鈕應該打開我的頁面中心窗口。打開彈出在劍道UI模式的中心

$(function() { 
     var offset = 0; 
     var windowWidth = $(document).width(); 
     var parametrs = '[email protected]&[email protected]'; 
     var popupWindow = $(".popupWindow").each(function() { 
      var popupWindows = $(this).kendoWindow({ 
       iframe: true, 
       width: $(document).width() - 25, 
       height: 300, 
       resizable: false, 
       draggable: false, 
       actions: ["Minimize", "Maximize", "Close"], 
       visible: false, 
       content: '@Url.Action("Index", "Editor")?' + parametrs, 

      }).data('kendoWindow'); 

      var parent = $(this).parent(); 
      parent.css("top", parent.offset().top + offset); 
      offset += parent.outerHeight(); 
      popupWindows.open(); 


     }); 
     $("#container").sortable(); 
    }); 

我使用kendo ui窗口。

+1

問題是? ) –

回答

1

popupWindows.center()將居中彈出。

0
$(function() { 
    var offset = 0; 
    var windowWidth = $(document).width(); 
    var parametrs = '[email protected]&[email protected]'; 
    var popupWindow = $(".popupWindow").each(function() { 
     var popupWindows = $(this).kendoWindow({ 
      iframe: true, 
      width: $(document).width() - 25, 
      height: 300, 
      resizable: false, 
      draggable: false, 
      actions: ["Minimize", "Maximize", "Close"], 
      **open : function() { this.center(); }** 
      visible: false, 
      content: '@Url.Action("Index", "Editor")?' + parametrs, 

     }).data('kendoWindow'); 

     var parent = $(this).parent(); 
     parent.css("top", parent.offset().top + offset); 
     offset += parent.outerHeight(); 
     popupWindows.open(); 


    }); 
    $("#container").sortable(); 
}); 

添加open的函數,每次打開彈出窗口時都會觸發該函數。在此功能中使用center(),因此每次打開頁面時都會將彈出窗口置於頁面的中心位置。

或者您可以簡單地使用聲明後的聲明popupWindows.center()