1. 程式人生 > >為表格添加可調整列寬功能

為表格添加可調整列寬功能

font code 調整 thead blank download .com 定義 jquery

1、引入js架包

  <script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>

  <script src="js/colResizable-1.6.js" type="text/javascript"></script>  (該jar包是為表格添加列寬自定義功能)

2、table頁面內容

  <table id="contentTable"
  class="table table-striped table-bordered table-condensed">
    <thead>
      <tr>
        <th>標題</th>
        <th>類型</th>
        <th class="sort-column login_name">狀態</th>
        <th class="sort-column name">查閱狀態</th>
        <th>更新時間</th>
     </tbody>
  </table>

技術分享圖片

4、js代碼

  <script type="text/javascript">

    $(function() {

       $("table").colResizable();

     });

  </script>

 這樣為你的表單加上table樣式,你的表格就可以自定義拉升大小了。

4、附上官網地址

  jQuery插件來調整表列的大小


  官網地址:http://www.bacubacu.com/colresizable/

 colResizable-1.6插件下載地址:https://download.csdn.net/download/oranxiaoluo/10352596

 

為表格添加可調整列寬功能