拖拽分割面板

2024-10-15  本文已影响0人  zkzhengmeng
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>split拖拽分割</title>
        <link rel="stylesheet" href="layui/css/layui.css">
        <!-- <script src="https://cdn.jsdelivr.net/npm/split.js@1.6.1/dist/split.min.js"></script> -->
        <script src="./split.js.min.js"></script>
        <style>
            .split{
                width:100%;
                display: flex;
            }
            .split_left{
                width:500px;
                height: 100vh;
                background-color: bisque;
            }
            .split_right{
                 width: calc(100% - 500px);
                 height: 100vh;
                 background-color: aqua;
            }
            .gutter {
                background-color: #eee;
                background-repeat: no-repeat;
                background-position: 50%;
             }
            .gutter.gutter-horizontal {
                background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
                cursor: col-resize;
            }
            
        </style>
    </head>
    <body>
       <div class="split">
         <div class="split_left">
           <p>Pane A</p>
         </div>
         <div class="split_right">
           <p>Pane B</p>
         </div>
       </div>
        <script>
            Split(['.split_left','.split_right'], {
              sizes: [40, 60],
              minSize: 100,
              gutterSize:8,
              direction: 'horizontal',
              onDragEnd: function(e){
                   console.log('我变化了',e);
              }
            })

        </script>
    </body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读