中文字幕在线一区二区在线,久久久精品免费观看国产,无码日日模日日碰夜夜爽,天堂av在线最新版在线,日韩美精品无码一本二本三本,麻豆精品三级国产国语,精品无码AⅤ片,国产区在线观看视频

      jQuery實現(xiàn)的拖動調(diào)整表格單元格的大小代碼實例

      時間:2024-08-14 23:59:11 jQuery 我要投稿
      • 相關(guān)推薦

      jQuery實現(xiàn)的拖動調(diào)整表格單元格的大小代碼實例

        jQuery實現(xiàn)的拖動調(diào)整表格td單元格的大小:

        在實際應(yīng)用中,可能有這樣的需求,那就是需要調(diào)整td單元格的大小。

        也許是為了便于觀察,也許是其他原因,反正這樣的需求是有的,下面就分享一段能夠?qū)崿F(xiàn)此功能的代碼。

        代碼實例如下:

        復(fù)制代碼 代碼如下:

        table {

        border-collapse: collapse;

        }

        td {

        text-align: center;

        }

        (function ($){

        $.fn.tableresize = function () {

        var _document = $("body");

        $(this).each(function () {

        if (!$.tableresize) {

        $.tableresize = {};

        }

        var _table = $(this);

        //設(shè)定ID

        var id = _table.attr("id") || "tableresize_" + (Math.random() * 100000).toFixed(0).toString();

        var tr = _table.find("tr").first(), ths = tr.children(), _firstth = ths.first();

        //設(shè)定臨時變量存放對象

        var cobjs = $.tableresize[id] = {};

        cobjs._currentObj = null, cobjs._currentLeft = null;

        ths.mousemove(function (e) {

        var _this = $(this);

        var left = _this.offset().left,

        top = _this.offset().top,

        width = _this.width(),

        height = _this.height(),

        right = left + width,

        bottom = top + height,

        clientX = e.clientX,

        clientY = e.clientY;

        var leftside = !_firstth.is(_this) && Math.abs(left - clientX) <= 5,

        rightside = Math.abs(right - clientX) <= 5;

        if (cobjs._currentLeft||clientY>top&&clientY

        _document.css("cursor", "e-resize");

        if (!cobjs._currentLeft) {

        if (leftside) {

        cobjs._currentObj = _this.prev();

        }

        else {

        cobjs._currentObj = _this;

        }

        }

        }

        else {

        cobjs._currentObj = null;

        }

        });

        ths.mouseout(function (e) {

        if (!cobjs._currentLeft) {

        cobjs._currentObj = null;

        _document.css("cursor", "auto");

        }

        });

        _document.mousedown(function (e) {

        if (cobjs._currentObj) {

        cobjs._currentLeft = e.clientX;

        }

        else {

        cobjs._currentLeft = null;

        }

        });

        _document.mouseup(function (e) {

        if (cobjs._currentLeft) {

        cobjs._currentObj.width(cobjs._currentObj.width() + (e.clientX - cobjs._currentLeft));

        }

        cobjs._currentObj = null;

        cobjs._currentLeft = null;

        _document.css("cursor", "auto");

        });

        });

        };

        })(jQuery);

        $(document).ready(function () {

        $("table").tableresize();

        });


                  

                  

                  
      ID
      名字
      年紀(jì)
      地址
      電話

                  
      22
      Name:44
      Age:23
      Address:47
      Phone:15

                  
      28
      Name:42
      Age:68
      Address:30
      Phone:50

                  
      29
      Name:63
      Age:48
      Address:90
      Phone:76

      【jQuery實現(xiàn)的拖動調(diào)整表格單元格的大小代碼實例】相關(guān)文章:

      基于jQuery的固定表格頭部的代碼08-30

      關(guān)jQuery彈出窗口簡單實現(xiàn)代碼-javascript編程06-07

      jquery提交按鈕的代碼07-28

      關(guān)于jQuery實現(xiàn)高亮顯示的方法介紹08-20

      JavaScript實現(xiàn)網(wǎng)頁刷新代碼段08-07

      將php實現(xiàn)過濾UBB代碼09-11

      excel怎樣隱藏表格單元格08-05

      防盜鏈接ASP函數(shù)實現(xiàn)代碼01-23

      常用排序算法之JavaScript實現(xiàn)代碼段06-04

      關(guān)于jquery簡單圖片切換顯示效果實現(xiàn)方法介紹10-01

      主站蜘蛛池模板: 国产美女自拍国语对白| 日本女优中文字幕在线一区| 衢州市| av网站可以直接看的| 日韩国产有码在线观看视频| 久久久精品国产精品久久| 亚洲欧美成人在线免费| 亚洲精品成人网线在线播放va| 精品综合久久久久久99| 亚洲日本国产乱码va在线观看| 久久久精品国产亚洲麻色欲| 巫溪县| 精品无码国产一二三区麻豆| 91网红福利精品区一区二| 天天摸天天做天天爽天天舒服| 北京市| 广汉市| 亚洲中文字幕人妻诱惑| 青青青在线观看视频免费播放| 完整在线视频免费黄片| 久久人成免费网站小草| 亚洲国产精一区二区三区性色| 延川县| 华亭县| 盐池县| 安塞县| 黑水县| 泾阳县| 遂宁市| 平阳县| 砀山县| 乌拉特后旗| 人妖熟女少妇人妖少妇| 霞浦县| 亚洲专区在线观看第三页| 中文字幕人妻一区二区三区四区| 激情人妻网址| 精品久久久久久午夜| 黄色av三级在线免费观看| 亚洲日韩精品AⅤ片无码富二代| 平谷区|