前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ExtJs学习笔记(11)_Absolute布局和Accordion布局

ExtJs学习笔记(11)_Absolute布局和Accordion布局

作者头像
菩提树下的杨过
发布2018-01-22 17:47:23
9790
发布2018-01-22 17:47:23
举报

ExtJs其实在某种程度上可以代替div+css来进行页面布局(不过经测试,在最新的Firefox3下,部分功能好象有点问题),今天我们来学习二种最基本的布局

1.Absolute 布局:这种最容易理解,直接用x,y值来绝对定位组件

2.Accordion布局:Accordion意为"手风琴",即最终效果可以象手风琴那样拉来拉去,说白了,就是类似QQ面板的功能

下面通过示例代码观察一下效果:

代码语言:js
复制
<!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>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
 <script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
 <script type="text/javascript" src="../ext-all-debug.js"></script> 
 <script type="text/javascript" src="../Extjs_Intellisense.js"></script>
 <title>Layout_Border示例</title>
 <style type="text/css">
         #panel2 .x-panel-body {
             background:#ffe;
             color:#15428B;
 }
         #panel2 .x-panel-header-text {
             color:#f00;
 }
 
 </style>
 </head>
 <body>
 <script type="text/javascript">
     Ext.onReady(function() {
 
 //layout:absolute(绝对定位布局)
  var win = new Ext.Window({
             title: "Absolute Layout",
             height: 400,
             width: 400,
             plain: true,
             x: 10,
             y:10,
             layout:'absolute',
             items: [
 new Ext.Panel({
                     title:"panel 1",
                     x:50,
                     y: 50,
                     width: 100,
                     height:100,
                     html:"Positioned at x:50,y:50",
                     frame:true
                 }),
 new Ext.Panel({
                     title: "panel 2",
                     x: 125,
                     y: 125,
                     width: 100,
                     height: 100,
                     html: "Positioned at x:125,y:125",
                     frame: true
                 })
             ]
 
         })
         win.show();
 
 
 //layout:Accordion(类似QQ面板的布局)
  var win2 = new Ext.Window({
             title: "Accordion Layout",
             height: 400,
             width: 200,
             x: 420,
             y:10,
             plain: true,
             layout: 'accordion',
             items: [
 new Ext.Panel({
                     title: "panel 1",
                     id:"panel1",                  
                     html: "panel one",
                     frame: true
                 }),
 new Ext.Panel({
                     title: "panel 2",
                     id:"panel2",
                     html: "panel two",
                     frame: true
                 })
             ]
 
         })
         win2.show();
     });
 </script>
 </body>
 </html>

效果图:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2008-09-01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档