easyui tabs内容panel自适应窗体宽度方法

废话不说,直接上代码:

$('#Teacherwin_details').window({
                    title: '查看教职工信息',
                    width: 800,
                    height: 520,
                    top: ($(window).height() - 720) * 0.5,
                    left: ($(window).width() - 800) * 0.5,
                    modal: true,
                    onResize: function (width,height) {
                        var stab = $('#Teacher_tab').tabs('getSelected');
                        var actWidth = width; if (width > 38) { actWidth = width - 38; }
                        stab.width(actWidth);
                    }
                }).window('open');
                $('#Teacherfm_details').form('load', row);
                $('#Teacher_tab').tabs('select', 0);

 注意:代码中的38是这样得到的:在默认情况下,窗体的宽度为800,而监视stab时发现stab的宽度为762,因此,stab与窗体之间有38个像素的间隙。写代码时,也可以直接用变量代替38,使代码更直观,更优雅。

posted @ 2013-11-26 15:14  Shapley  阅读(12114)  评论(0编辑  收藏  举报