• 宽度可变的Table


        <script>
            var drag_left = 0;
            var mouse_downX = 0;
            function drag_event_mousedown(e) {
                var e, obj, temp;
                e = window.event ? window.event : e;
                obj = document.getElementById("drag");
    
                drag_left = obj.offsetLeft;
                mouse_downX = e.clientX;
                document.onmousemove = document_event_mousemove;
                temp = document.attachEvent ? document.attachEvent("onmouseup", document_event_mouseup) : document.addEventListener("mouseup", document_event_mouseup, "");
            }
    
            function document_event_mousemove(e) {
                var e, obj;
                e = window.event ? window.event : e;
                obj = document.getElementById("move");
                with (obj.style) {
                    width = drag_left + (e.clientX - mouse_downX) + "px";
                }
            }
    
            function document_event_mouseup(e) {
                document.onmousemove = "";
                td_width = document.getElementById("drag").style.width;
            }
        </script>
    </head>
    <body>
        <table style=" 100%; height: 1000px" border="1px" cellpadding="0" cellspacing="0">
            <tr>
                <td id="move" style=" 180px; height: 1000px; vertical-align: text-top">ddddd
                </td>
                <td id="drag" onmousedown="drag_event_mousedown(arguments[0]);" style=" 1px; height: 1000px; vertical-align: text-top; cursor: e-resize;"></td>
                <td id="content" style="height: 1000px; background-color: Transparent; text-align: left; vertical-align: top;">fffffffffffffffffffffffffffffffffffffff
                </td>
            </tr>
        </table>
    </body>
    
    
    
    
    Jquery方式
        <style type="text/css">
            #container {
                 600px;
                height: 600px;
                background-color: #999999;
            }
    
            #markline {
                border-left: 1px solid #00686b;
                height: 333px;
                position: absolute;
                display: none;
                cursor: col-resize;
            }
        </style>
        <script src="../Script/jquery-1.9.1.js"></script>
        <script>
            $(function () {
                var mark_move = false;
                $("#canMove").mousedown(function (e) {
                    mark_move = true;
                    $("#markline").css("display", "block");
                });
    
                $(document).mousemove(function (e) {
                    if (mark_move) {
                        $("#markline").offset({ left: e.pageX });
                    }
                });
                $(document).mouseup(function () {
                    mark_move = false;
                    $("#markline").css("display", "none");
                });
            })
        </script>
    </head>
    <body>
        <div id="markline">
        </div>
        <div id="container">
            <div style=" 2px; height: 40px; background-color: #00ff21; cursor: col-resize;" id="canMove"></div>
        </div>
    </body>
    
    
    
  • 相关阅读:
    自建 IPA 分发平台
    一个优雅的占位图解决方案。适用于 UITableView 和 UICollectionView。
    Vuejs2.0购物车和地址选配学习笔记
    UIWebView 加 MJRefresh 同时解决底部黑影问题
    UIWebView 不自动全屏播放视频
    左右分页按钮的集合视图控件。用于快速编写出集合视图上分页多按钮点击事件!
    课程总结
    IO流实训
    事件处理
    变色
  • 原文地址:https://www.cnblogs.com/potoofly/p/3117356.html
Copyright © 2020-2023  润新知