jquery实现表格列拖动位置效果代码

代码语言:html

所属分类:拖放

代码描述:jquery实现表格列拖动位置效果代码

代码标签: 拖动 位置 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">


    <style>
        .no-select-text {
            user-select: none;
            -moz-user-select: none;
            -webkit-user-select: none;
        }
        #headTable td {
            border-bottom: 0px;
            cursor: all-scroll;
        }
        #mainTable td {
            width: 77px;
            border-top: 0px;
        }
        #info {
            background: #eee;
            border: 1px solid #eee;
            width: 100px;
            height: 30px;
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }
        .arrow {
            width: 10px;
            height: 10px;
            position: relative;
            /*display: inline-block;*/
            /*margin: 10px 10px;*/
        }

        .arrow:before, .arrow:after {
            content: '';
            border-color: transparent;
            border-style: solid;
            position: absolute;
        }



        .arrow-up:before {
            border: none;
            background-color: red;
            height: 50%;
            width: 30%;
            top: 50%;
            left: 35%;
        }

        .arrow-up:after {
            left: 0;
            top: -50%;
            border-width: 5px 5px;
            border-bottom-color: red;
        }
        .arrow-down:before {
            border: none;
            background-color: red;
            height: 50%;
            width: 30%;
            top: 0;
            left: 35%;
        }

        .arrow-down:after {
            left: 0;
            top: 50%;
            border-width: 5px 5px;
            border-top-color: red;
        }
        #triangle {
            display: none;
            position: absolute;
            top: 0px;
            left: 4px;
        }
    </style>

</head>

<body>

    <div id="main">
        <table id="headTable" border="1" cellpadding="0" cellspacing="0" style="width:400px;text-align:center;">
            <tr style="background-color: #E5E5E5">
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
            </tr>
        </table>
        <table id="mainTable" border="1" cellpadding="0" cellspacing="0" style="width:400px;text-align:center;">
            <tr>
                <td>6</td>
                <td>7</td>
                <td>8</td>
                <td>9</td>
                <td><div style="color:red;">
                    ten<span style="display:none">123</span>
                </div>
                    10</td>
            </tr>
            <tr>
                <td>6</td>
                <td>7</td>
                <td>8</td>
                <td>9</td>
                <td><div style="color:red;">
                    ten<span style="display:none">123</span>
                </div>
                    10</td>
            </tr>
            <tr>
                <td>61</td>
                <td>71</td>
                <td>81</td>
                <td>91</td>
                <td><div style="color:red;">
                    ten<span style="display:none">123</span>
                </div>
                    101</td>
            </tr>
        </table>
        <div id="info"></div>
        <div id="triangle">
            <div class="arrow arrow-down"></div>
            <div class="arrow arrow-up"></div>
        </div>
    </div>

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript">
        var h .........完整代码请登录后点击上方下载按钮下载查看

网友评论0