• <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <small id="ggggg"></small> <sup id="ggggg"></sup>
    <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <tfoot id="ggggg"></tfoot>
  • <nav id="ggggg"><cite id="ggggg"></cite></nav>
    <nav id="ggggg"></nav>
    成人黃色A片免费看三更小说,精品人妻av区波多野结衣,亚洲第一极品精品无码,欧美综合区自拍亚洲综合,久久99青青精品免费观看,中文字幕在线中字日韩 ,亚洲国产精品18久久久久久,黄色在线免费观看

    datatable 拖動列寬 鼠標拖動列寬

    2021-7-23    前端達人


    本篇博客所用到的技術也是從別的博客學習到的,但目前找不到那篇博客的鏈接了。

    1.普通表格實現拖動列寬

    var tabSize = tabSize || {}; tabSize.init = function (id) { //用來存儲當前更改寬度的Table Cell,避免快速移動鼠標的問題 var tTD; // 獲取需要修改列寬的表格 var table = document.getElementById(id); var headTh = table.rows[0]; for (j = 0; j < headTh.cells.length; j++) { headTh.cells[j].onmousedown = function () { //記錄單元格 tTD = this; if (event.offsetX > tTD.offsetWidth - 10) { tTD.mouseDown = true; tTD.oldX = event.x; tTD.oldWidth = tTD.offsetWidth; } }; headTh.cells[j].onmouseup = function () { //結束寬度調整 if (tTD == undefined) tTD = this; tTD.mouseDown = false; tTD.style.cursor = 'default'; }; headTh.cells[j].onmousemove = function () { //更改鼠標樣式 if (event.offsetX > this.offsetWidth - 10) this.style.cursor = 'col-resize'; else this.style.cursor = 'default'; //取出暫存的Table Cell if (tTD == undefined) tTD = this; //調整寬度 if (tTD.mouseDown != null && tTD.mouseDown == true) { tTD.style.cursor = 'default'; if (tTD.oldWidth + (event.x - tTD.oldX) > 0) tTD.width = tTD.oldWidth + (event.x - tTD.oldX); //調整列寬 tTD.style.width = tTD.width + 'px'; tTD.style.cursor = 'col-resize'; // 調整滾動表格的每個cell for (k = 0; k < table.rows.length; k++) { table.rows[k].cells[tTD.cellIndex].style.width = tTD.style.width; } } }; } }; // 調用 // 鼠標拖動列寬 setTimeout(function () { // 1.html代碼里就是一個普通的table元素 // 2.傳入table元素的id tabSize.init('documentList'); }, 600); 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    在這里插入圖片描述
    在這里插入圖片描述
    在這里插入圖片描述

    2.datatable實現鼠標拖動列寬

    1. 項目中用到datatable插件的地方,都是需要上下滾動的;而datatable插件實現上下滾動,是生成了兩個div各包含了一個table,一個表格里只包含thead并且固定住(類:dataTables_scrollHead),另一個實現table內容滾動(類:dataTables_scrollBody) 。
    2. 那么,若要實現鼠標拖動列寬的話,則需要:表頭綁定鼠標事件→事件觸發時兩個表格的對應列的寬度都要改變
    3. 若這個datatable表格原本沒有滾動條的話,在鼠標拖動列寬的時候,會出現滾動條,其中,datatable定義時,“scrollX”: true在這里插入圖片描述
      在這里插入圖片描述
    var tabSize = tabSize || {}; tabSize.init = function (id,headTableWrapperId) { //用來存儲當前更改寬度的Table Cell,避免快速移動鼠標的問題 var tTD; // 獲取需要修改列寬的表格 var table = document.getElementById(id); // 獲取固定頭部的表格 var tableHead = $('#'+ headTableWrapperId + ' .dataTables_scrollHeadInner table')[0]; // 獲取表格頭部th var headTh = tableHead.rows[0]; for (j = 0; j < headTh.cells.length; j++) { headTh.cells[j].onmousedown = function () { //記錄單元格 tTD = this; if (event.offsetX > tTD.offsetWidth - 10) { tTD.mouseDown = true; tTD.oldX = event.x; tTD.oldWidth = tTD.offsetWidth; } }; headTh.cells[j].onmouseup = function () { //結束寬度調整 if (tTD == undefined) tTD = this; tTD.mouseDown = false; tTD.style.cursor = 'default'; }; headTh.cells[j].onmousemove = function () { //更改鼠標樣式 if (event.offsetX > this.offsetWidth - 10) this.style.cursor = 'col-resize'; else this.style.cursor = 'default'; //取出暫存的Table Cell if (tTD == undefined) tTD = this; //調整寬度 if (tTD.mouseDown != null && tTD.mouseDown == true) { tTD.style.cursor = 'default'; if (tTD.oldWidth + (event.x - tTD.oldX) > 0) tTD.width = tTD.oldWidth + (event.x - tTD.oldX); //調整列寬 tTD.style.width = tTD.width + 'px'; tTD.style.cursor = 'col-resize'; // 調整滾動表格的每個cell for (k = 0; k < table.rows.length; k++) { table.rows[k].cells[tTD.cellIndex].style.width = tTD.style.width; } } }; } }; // 鼠標拖動列寬 setTimeout(function () { // 參數:1.table元素的id, // 2.datatable插件生成的最外層div的id,F12可查看到 tabSize.init('cfcPlanListIn','cfcPlanListIn_wrapper'); }, 2000); 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57

    在這里插入圖片描述
    在這里插入圖片描述

    藍藍設計建立了UI設計分享群,每天會分享國內外的一些優秀設計,如果有興趣的話,可以進入一起成長學習,請掃碼藍小助,報下信息,藍小助會請您入群。歡迎您加入噢~~希望得到建議咨詢、商務合作,也請與我們聯系。

    截屏2021-05-13 上午11.41.03.png


    文章來源:csdn 作者:阿晏

    分享此文一切功德,皆悉回向給文章原作者及眾讀者.
    免責聲明:藍藍設計尊重原作者,文章的版權歸原作者。如涉及版權問題,請及時與我們取得聯系,我們立即更正或刪除。

    藍藍設計m.lzhte.cn )是一家專注而深入的界面設計公司,為期望卓越的國內外企業提供卓越的UI界面設計、BS界面設計 、 cs界面設計 、 ipad界面設計 、 包裝設計 、 圖標定制 、 用戶體驗 、交互設計、 網站建設 平面設計服務

    日歷

    鏈接

    個人資料

    藍藍設計的小編 http://m.lzhte.cn

    存檔

    主站蜘蛛池模板: 欧美A级V片高潮喷水| 国产欧美日韩久久va| 日韩欧美在线综合网| 久久香蕉国产线看观看精品蕉| 亚洲成人资源在线观看| 亚洲熟女av一区激情| 中文人妻av高清一区二区| 国产成人精品1024免费下载 | 五月婷婷丁香六月| 欧美性猛交XXXX乱大交| 国产自产精品青青草原| 男女高潮又爽又黄又无遮挡| 国产人妻久久精品一区二区三区 | 国产伊人色噜噜综合网| 日韩有码国产精品一区| 神马午夜久久精品人妻| 亚洲欧美国产制服一区| 亚洲成AV人片一区二区| 老司机午夜福利视频| 国产成人精品三级在线影院| 新婚人妻不戴套国产精品| P尤物久久99国产综合精品| 熟女人妻精品一区二区视频| 亚洲第一免费播放区| 精久国产一区二区三区四区| 欧美人与物videos另类一| 99久久伊人精品综合观看| 国产成人综合久久精品| 青青草免费在线播放视频五月天| 亚洲精品5555在线| 日韩A级毛片一区二区三区| 久久精品丝袜高跟鞋| 国产青榴视频在线观看| 国产成人精品视频三级| 婷婷丁香五月天永久在线| 在线观看日本一区二区| 中文无码字幕一区到五区免费| 美女国产爆浆精品视频| 99精品无码一区二区| 九九热久久免费视频| 久久青草精品一区二区三区|