1、

在html中加入

<script>
/**
* layout方法扩展
* @param {Object} jq
* @param {Object} region
*/
$.extend($.fn.layout.methods, {
/**
* 移除header
* @param {Object} jq
* @param {Object} region
*/
removeHeader: function(jq, region){
return jq.each(function(){
var panel = $(this).layout("panel",region);
if(panel){
panel.panel('removeHeader');
panel.panel('resize');
}
});
},
/**
* 增加header
* @param {Object} jq
* @param {Object} params
*/
addHeader:function(jq, params){
return jq.each(function(){
var panel = $(this).layout("panel",params.region);
var opts = panel.panel("options");
if(panel){
var title = params.title?params.title:opts.title;
panel.panel('addHeader',{title:title});
panel.panel('resize');
}
});
},
/**
* 面板是否存在和可见
* @param {Object} jq
* @param {Object} params
*/
isVisible: function(jq, params) {
var panels = $.data(jq[0], 'layout').panels;
var pp = panels[params];
if(!pp) {
return false;
}
if(pp.length) {
return pp.panel('panel').is(':visible');
} else {
return false;
}
},
/**
* 隐藏除某个region,center除外。
* @param {Object} jq
* @param {Object} params
*/
hidden: function(jq, params) {
return jq.each(function() {
var opts = $.data(this, 'layout').options;
var panels = $.data(this, 'layout').panels;
if(!opts.regionState){
opts.regionState = {};
}
var region = params;
function hide(dom,region,doResize){
var first = region.substring(0,1);
var others = region.substring(1);
var expand = 'expand' + first.toUpperCase() + others;
if(panels[expand]) {
if($(dom).layout('isVisible', expand)) {
opts.regionState[region] = 1;
panels[expand].panel('close');
} else if($(dom).layout('isVisible', region)) {
opts.regionState[region] = 0;
panels[region].panel('close');
}
} else {
panels[region].panel('close');
}
if(doResize){
$(dom).layout('resize');
}
};
if(region.toLowerCase() == 'all'){
hide(this,'east',false);
hide(this,'north',false);
hide(this,'west',false);
hide(this,'south',true);
}else{
hide(this,region,true);
}
});
},
/**
* 显示某个region,center除外。
* @param {Object} jq
* @param {Object} params
*/
show: function(jq, params) {
return jq.each(function() {
var opts = $.data(this, 'layout').options;
var panels = $.data(this, 'layout').panels;
var region = params; function show(dom,region,doResize){
var first = region.substring(0,1);
var others = region.substring(1);
var expand = 'expand' + first.toUpperCase() + others;
if(panels[expand]) {
if(!$(dom).layout('isVisible', expand)) {
if(!$(dom).layout('isVisible', region)) {
if(opts.regionState[region] == 1) {
panels[expand].panel('open');
} else {
panels[region].panel('open');
}
}
}
} else {
panels[region].panel('open');
}
if(doResize){
$(dom).layout('resize');
}
};
if(region.toLowerCase() == 'all'){
show(this,'east',false);
show(this,'north',false);
show(this,'west',false);
show(this,'south',true);
}else{
show(this,region,true);
}
});
},
/**
* 设置某个region的宽度或者高度(不支持center)
* @param {[type]} jq [description]
* @param {[type]} params [description]
*/
setRegionSize:function(jq,params){
return jq.each(function(){
if(params.region=="center")
return;
var panel = $(this).layout('panel',params.region);
var optsOfPanel = panel.panel('options');
if(params.region=="north" || params.region=="south"){
optsOfPanel.height = params.value;
}else{
optsOfPanel.width = params.value;
}
$(this).layout('resize');
});
},
/**
* 设置north south east west区域标题的图标
* @param {[type]} jq [description]
* @param {[type]} params [description]
*/
setHeaderIcon:function(jq,params){
return jq.each(function(){
if(params.region=="center")
return;
var panel = $(this).layout('panel',params.region);
var title = panel.panel('header').find('>div.panel-title');
var icon = panel.panel('header').find('>div.panel-icon');
if(icon.length===0){
if(title.length && params.iconCls != null){
$('<div class="panel-icon ' + params.iconCls + '"></div>').insertBefore(title);
title.addClass('panel-with-icon');
}
}else{
if(params.iconCls == null){
icon.remove();
title.removeClass('panel-with-icon');
}else{
icon.attr('class','').addClass('panel-icon ' + params.iconCls);
}
}
});
},
/**
* 设置north south east west的split是否可以拖动
* @param {[type]} jq [description]
* @param {[type]} params [description]
*/
setSplitActivateState:function(jq,params){
return jq.each(function(){
if(params.region=="center")
return;
$(this).layout('panel',params.region).panel('panel').resizable(params.disabled?'disable':'enable');
});
},
/**
* 设置north south east west的split是否显示
* @param {[type]} jq [description]
* @param {[type]} params [description]
*/
setSplitVisiableState:function(jq,params){
return jq.each(function(){
if(params.region=="center")
return;
var panel = $(this).layout('panel',params.region);
panel.panel('options').split = params.visible;
if(params.visible){
panel.panel('panel').addClass('layout-split-north');
}else{
panel.panel('panel').removeClass('layout-split-north');
}
//panel.panel('resize');
$(this).layout('resize');
});
},
/**
* 设置region的收缩按钮是否可见
* @param {[type]} jq [description]
* @param {[type]} params [description]
*/
setRegionToolVisableState:function(jq,params){//就是调用这个方法,其他方法也可以删掉
return jq.each(function(){
if(params.region=="center")
return;
var panels = $.data(this, 'layout').panels;
var panel = panels[params.region];
var tool = panel.panel('header').find('>div.panel-tool');
tool.css({display:params.visible?'block':'none'});
var first = params.region.substring(0,1);
var others = params.region.substring(1);
var expand = 'expand' + first.toUpperCase() + others;
if(panels[expand]){
panels[expand].panel('header').find('>div.panel-tool').css({display:params.visible?'block':'none'});
}
});
}
});
</script>

2、在body中加入onload事件

3、写onload事件

function close(){
$(document.body).layout('setRegionToolVisableState',{region:'west',visible:false});//红色的位置填要隐藏的父选择器,我的div父亲是body,body的选择器为document.body
}

4、效果为:

easyui布局隐藏伸缩按钮的更多相关文章

  1. iOS -- 隐藏返回按钮

    // 隐藏返回按钮 [self.navigationItem setHidesBackButton:YES];

  2. easyui_动态添加隐藏toolbar按钮

    目标:动态添加隐藏toolbar,比如根据权限动态显示新增.修改.删除按钮等 思路:先初始化toolbar的所有按钮,加载datagrid其它信息,再根据权限显示隐藏toolbar按钮 步骤: 1.加 ...

  3. datebox清除按钮,datebox加上清除按钮,easyui datebox加上清除按钮

    datebox加上清除按钮,easyui datebox加上清除按钮 >>>>>>>>>>>>>>>>& ...

  4. Easyui布局

    Easyui入门视频教程 第03集---Easyui布局 Easyui入门视频教程 第03集---Easyui布局 目录 -----------------------   Easyui入门视频教程 ...

  5. EasyUI学习总结(六)——EasyUI布局

    一.EasyUI布局介绍 easyUI布局容器包括东.西.南.北.中五个区域,其中中心面板是必须的,而东.西.南.北这四个面板是可选的,如果布局里面不需要东.西.南.北这四个面板,那么可以把相应的di ...

  6. Easyui入门视频教程 第04集---Easyui布局

    目录 目录 ----------------------- Easyui入门视频教程 第09集---登录完善 图标自定义   Easyui入门视频教程 第08集---登录实现 ajax button的 ...

  7. Easyui入门视频教程 第03集---Easyui布局

    Easyui入门视频教程 第03集---Easyui布局 目录 ----------------------- Easyui入门视频教程 第09集---登录完善 图标自定义   Easyui入门视频教 ...

  8. sencha touch 扩展官方NavigationView 灵活添加按钮组,导航栏,自由隐藏返回按钮(2014-5-15)

    扩展视频讲解:http://www.cnblogs.com/mlzs/p/3652094.html官方NavigationView详解:http://www.cnblogs.com/mlzs/p/35 ...

  9. CSS3 Flex布局(伸缩布局盒模型)学习

    CSS3 Flex布局(伸缩布局盒模型)学习 转自:http://www.xifengxx.com/web-front-end/1408.html CSS2定义了四种布局:块布局.行内布局.表格布局盒 ...

随机推荐

  1. buglly热更新集成遇到的那些坑

    首先说明使用热修复的意义,那就是你的apk包发出去了,万一发生了紧急异常需要修复,怎么办?这时候再发包上市场审核,也是有点慢了吧?而且错误发生在apk中,无法通过后台接口修复,这时候你就需要一个强大的 ...

  2. curl命令实现上网认证登录

    为了想让组里的服务器连外网下数据,需要命令行上网登录.与很多高校的上网方式一样,大气所上网采用的是用户帐号登录验证的方法.上网需要需要先开浏览器,然后打开网页输入帐号密码登录.参考了前人的一些帖子,最 ...

  3. eclipse生成ant build.xml打war包

      背景: 最近想实现jenkins+ant命令一键打war包,部署到测试环境,然后自动化接口测试,结果发现用eclipse本身导出的ant buildfiles文件,打包出来都是空文件.很多代码都没 ...

  4. 【Unity Shader】(六) ------ 复杂的光照(上)

    笔者使用的是 Unity 2018.2.0f2 + VS2017,建议读者使用与 Unity 2018 相近的版本,避免一些因为版本不一致而出现的问题.              [Unity Sha ...

  5. Overlay 网络

  6. Nginx 使用(server参数配置)

    文件地址nginx/conf/Nginx.conf 文件地址;nginx/conf/Nginx.conf [java] view plain copy server {# 服务名及配置,一个服务下可以 ...

  7. R语言安装R package的2种方法

    http://www.cnblogs.com/emanlee/archive/2012/12/05/2803606.html

  8. arcgis for android apk太大

    原来大概都要20多M, 太大的原来是.so文件 arcgis for android api里面有armeabi armeabi-v7a  x86的 每个so都接近10m 要是都保留就20多m了 由于 ...

  9. 灵悟礼品网上专卖店Sprint计划

    一.现状 小组成员初步了解了所做项目的大致内容,需要时间一步一步分析和规划. 二.部分需求索引卡 第一个阶段没有具体功能的实现,只是先把所要做的项目思路理清,并把相应的数据库建立好. 三.任务认领 产 ...

  10. mvc 路由配置-学习

    MapRoute(RouteCollection, String, String) 映射指定的URL路由. 'Declaration <ExtensionAttribute> _ Publ ...