2010-07-01 62 views
1

我有第一頁。在哪裏是一個鏈接,打開jQuery對話與iframe與第二頁內。 第二頁內有可調整大小的textarea。 其實textarea只有當我打開第二頁時嚴格無iframe才能調整大小,但它在iframe中不能調整大小。 如何解決?在iframe中可調整大小的jQuery問題

UPD: 這是從第一頁我的html代碼:

  1. <div id="dialog-system" title="system settings">
  2.   <div class="loadingDivForDialog"><img src="Control/Image/loading.gif" alt="loading..." /></div>
  3.   <iframe id="SystemFrame" src="" scrolling="no" frameborder="0"></iframe>
  4. </div>
* This source code was highlighted with Source Code Highlighter .

這是腳本opent對話框:

  1. function showSystemDialog(propertyName, id_prov, psysName, currentItemForTick) {
  2.   $('.loadingDivForDialog').show();
  3.   $('#SystemFrame').hide();
  4.  
  5.   var defaultSrc = "Settings.aspx?pro=" + propertyName + "&id_prov=" + id_prov;
  6.   $("#systemFrame").attr('src', String(defaultSrc));
  7.  
  8.   $("#dialog-system").dialog({
  9.     resizable: false,
  10.     height: 300,
  11.     width: 680,
  12.     modal: true,
  13.     position: 'center',
  14.     buttons: {}
  15.   });
  16.   $('#SystemFrame').load(function() {
  17.     $('.loadingDivForDialog').hide();
  18.     $('#SystemFrame').show();
  19.     $('#SystemFrame').contents().find("input[value='Update']").click(function() {
  20.  
  21.       var obj = $("#" + currentItemForTick);
  22.  
  23.       if (obj.get(0).tagName == "INPUT") {
  24.         obj.attr('checked', true);
  25.       }
  26.       else {
  27.         obj = window.parent.$("input[value='" + psysName + "']");
  28.  
  29.         obj.attr("checked", true);
  30.       }
  31.     });
  32.  
  33.     $('#SystemFrame').contents().find("input[value='Cancel']").click(function() { $("#dialog-system").dialog("close") });
  34.  
  35.     $("#dialog-system").dialog("option", "height", parseInt($('#SystemFrame').contents().height(), 10) + 35);
  36.   });
  37.   return false;
  38. }
* This source code was highlighted with Source Code Highlighter .

這是textarea的和腳本從第二頁碼:

  1. <textarea name="ctl00$ContentPlaceHolderBody$ctrl02$fldText" rows="2" cols="20" id="ctl00_ContentPlaceHolderBody_ctrl02_fldText" class="textbox"></textarea>
  2.  
  3. <script type="text/javascript">$(function() {
  4.   $("#ctl00$ContentPlaceHolderBody$ctrl02$fldText").resizable({
  5.     handles: "se",
  6.     maxWidth: 340,
  7.     minWidth: 196,
  8.     minHeight: 18
  9.   });
  10. });</script>
* This source code was highlighted with Source Code Highlighter .

UPD:任何想法?

+0

它看起來像可調整大小的插件無法計算高度和元素的寬度的更多細節。 – 2010-07-01 14:45:36

+0

你能發佈一些示例代碼嗎?有(可惜)很多事情可能會錯誤的iframe和jQuery。 – HurnsMobile 2010-07-01 15:18:26

+0

我已經添加了代碼。哪些事情可能會出錯? – 2010-07-01 15:49:49

回答

0

我在頁面上有iframe時遇到類似的調整大小的問題。我開始得出結論,即iframe阻止相關的鼠標處理程序進入jQuery中的調整大小邏輯。

不是一個嚴格的解決方案,但它可能指向某人在正確的方向。

UPDATE:見本jQuery的票的最後意見,可能的解決http://bugs.jqueryui.com/ticket/3176