Absolute绝对定位

  Ext.layout.container.Absolute对应面板布局配置项的Absolute,可以根据子面板中配置的x/y坐标进行定位。

  代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ext.layout.container.Absolute示例</title>
    <link href="ext-4.0.7-gpl/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
    <script src="ext-4.0.7-gpl/bootstrap.js" type="text/javascript"></script>
    <script type="text/javascript">
        Ext.onReady(function () {
            Ext.create("Ext.panel.Panel", {
                title: "Ext.layout.container.Absolute示例",
                frame: true,
                 300,
                height: 200,
                renderTo: Ext.getBody(),
                bodyPadding: 5,
                layout: "absolute",
                defaults: {
                    bodyStyle: "background-color:#FFFFFF;padding:15px",
                    frame: true,
                    height: 70,
                     100
                },
                items: [{
                    x: 10,
                    y: 10,
                    title: "子面板一",
                    html: "子面板一"
                }, {
                    x: 130,
                    y: 40,
                    title: "子面板二",
                    html: "子面板二"
                }]
            });
        });
    </script>
</head>
<body>
</body>
</html>

  效果图:

原文地址:https://www.cnblogs.com/libingql/p/2471272.html