jqwidgets splitter把页面水平分割

该博客介绍了如何使用jqwidgets库将HTML页面水平分割为三个部分,详细步骤包括下载jqwidgets库,引入所需JS和CSS文件,并展示了具体的HTML和JavaScript代码实现。最终实现了50%、25%、25%的比例分割。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需求:将页面水平分割成三部分,比例分别是50%, 25%, 25%

设计步骤:

第一步:下载jqwidget https://www.jqwidgets.com/download/

第二步:将需要的js和css文件(jquery.min.js, jqxcore.js, jqxsplitter.js, jqxbuttons.js, jqxscrollbar.js, jqxpanel.js, demos.js, jqx.base.css )放到自定义的目录下。例如:***/plugins/jqwidgets/

第三步:引入所需的js和css文件,构建html代码如下:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head >
    <link rel="stylesheet" th:href="@{/assets/plugins/jqwidgets/jqx.base.css}" type="text/css"/>
</head>

<body>
    <div id='jqxWidget'>
        <div id="topSplitter">
            <div class="splitter-panel">
                panel1
            </div>
            <div class="splitter-panel">
                <div id="bottomSplitter">
                    <div class="splitter-panel" style="overflow: auto;">
                        panel2
                    </div>
                    <div class="splitter-panel" style="overflow: auto;">
                        panel3
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(function () {
            $('#topSplitter').jqxSplitter({ width: "100%", height: "100%", orientation: 'horizontal', panels: [{ size: "50%" }] });
            $('#bottomSplitter').jqxSplitter({ width: '100%', height: '100%', orientation: 'horizontal', panels: [{ size: '50%', collapsible: false }] });        
        });

    </script>
    <script type="text/javascript" src="../../scripts/jquery.min.js"></script>
    <script th:src="@{/assets/plugins/jqwidgets/jqxcore.js}"></script>
    <script th:src="@{/assets/plugins/jqwidgets/jqxsplitter.js}"></script>
    <script th:src="@{/assets/plugins/jqwidgets/jqxbuttons.js}"></script>
    <script th:src="@{/assets/plugins/jqwidgets/jqxscrollbar.js}"></script>
    <script th:src="@{/assets/plugins/jqwidgets/jqxpanel.js}"></script>
    <script th:src="@{/assets/plugins/jqwidgets/demos.js}"></script>
</body>
</html>

运行结果如下:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值