簡體   English   中英

調整jHtml文本區域的大小

[英]Resize jHtml text area

我想像普通文本區域一樣調整jHtml TextArea的大小,所以有沒有辦法調整大小。

以下是創建jHtml Textarea的代碼。

這是HTML代碼:

<table style="width: 100%; border-collapse: separate !important; border-spacing: 2px!important">
<tr>
    <td>
        <%=Html.LabelFor(m => m.Description)%>
    </td>
    <td>
        <%=Html.TextAreaFor(m => m.Description, new { @class="form-control",style="width: 610px; height: 150px" })%>
    </td>
</tr>
</table>

以下是javascript代碼:

<script type="text/javascript">
   $(function () {
    $("#Description").htmlarea({
        // Override/Specify the Toolbar buttons to show
        toolbar: [
            ["bold", "italic", "underline", "|", "forecolor"],
             ["p", "h3", "h4", "h5", "h6"],
              ["link", "unlink", "|", "image"],
              ["orderedlist", "unorderedlist"],
              ["increasefontsize", "decreasefontsize"],
              ["indent", "outdent"],
              ["justifyleft", "justifycenter", "justifyright"],
              ["cut", "copy", "paste"]
        ]
    });
});
</script>

您可以通過添加jHtmlarea的“resizable”屬性來實現該行為。 可以幫到你。

<script type="text/javascript">
   $(function () {
     $("#Description").htmlarea({           
          toolbar: [
             ["bold", "italic", "underline", "|", "forecolor"],
             ["p", "h3", "h4", "h5", "h6"],
             ["link", "unlink", "|", "image"],
             ["orderedlist", "unorderedlist"],
             ["increasefontsize", "decreasefontsize"],
             ["indent", "outdent"],
             ["justifyleft", "justifycenter", "justifyright"],
             ["cut", "copy", "paste"]
         ]
     }).parent().resizable({ alsoResize: $("#comm").find('iframe') });
  });
</script>

我的猜測是你可以通過使用css規則輕松實現所需的行為如下面的代碼片段所示:

 #Comments { position:absolute; width:60%; height:200px; } 
 <textarea id="Comments">My text.</textarea> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM