//左侧导航菜单
function leftMenus()
{
//$(".easyui-accordion").empty();
$.each(_menus.menus, function(i, n) {
$(".easyui-accordion").accordion('add',
{
title: n.text,
content:moduleIndex(n.menus),
iconCls:'icon-search'
});
});
$(".easyui-accordion").accordion();
liClick();
} function liClick()
{
$('.easyui-accordion li a').click(function()
{
var tabTitle = $(this).text();
/**
*处理tab切换问题:将"href"修改成"way"。
*/
var url = $(this).attr("way");
addTab(tabTitle,url);//打开tab选项卡
$('.easyui-accordion li div').removeClass("selected");
$(this).parent().addClass("selected");
}).hover(function()
{
$(this).parent().addClass("hover");
},function()
{
$(this).parent().removeClass("hover");
});
} function moduleIndex(menusData)
{
var text="";
text += '<ul>';
$.each(menusData,function(j,o)
{
/**
*处理tab切换问题:将‘a’标签中的"href"修改成"way"。
*/
text += '<li><div ><a target="mainFrame" way="'+o.attributes+'" >' + o.text + '</a></div></li> ';
});
text += '</ul>';
return text;
} function addTab(subtitle,url)
{
if(!$('#tabs').tabs('exists',subtitle))
{
$('#tabs').tabs('add',{
title:subtitle,
content:createFrame(url),
closable:false,
width:$('#mainPanle').width()-10,
height:$('#mainPanle').height()-26,
iconCls:'icon-search'
});
}
else
{
$('#tabs').tabs('select',subtitle);
}
tabClose();
} function createFrame(url)
{
var s = '<iframe name="mainFrame" scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
return s;
} function tabClose()
{
/*双击关闭TAB选项卡*/
$(".tabs-inner").dblclick(function(){
var subtitle = $(this).children("span").text();
$('#tabs').tabs('close',subtitle);
}) //绑定右键菜单
$(".tabs-inner").bind('contextmenu',function(e){
$('#mm').menu('show', {
left: e.pageX,
top: e.pageY,
}); var subtitle =$(this).children("span").text();
$('#mm').data("currtab",subtitle); return false;
});
} //绑定右键菜单事件
function tabCloseEven()
{
//关闭当前
$('#mm-tabclose').click(function(){
var currtab_title = $('#mm').data("currtab");
$('#tabs').tabs('close',currtab_title);
})
//全部关闭
$('#mm-tabcloseall').click(function(){
$('.tabs-inner span').each(function(i,n){
var t = $(n).text();
$('#tabs').tabs('close',t);
});
});
//关闭除当前之外的TAB
$('#mm-tabcloseother').click(function(){
var currtab_title = $('#mm').data("currtab");
$('.tabs-inner span').each(function(i,n){
var t = $(n).text();
if(t!=currtab_title)
$('#tabs').tabs('close',t);
});
});
//关闭当前右侧的TAB
$('#mm-tabcloseright').click(function(){
var nextall = $('.tabs-selected').nextAll();
if(nextall.length==0){
//msgShow('系统提示','后边没有啦~~','error');
alert('后边没有啦~~');
return false;
}
nextall.each(function(i,n){
var t=$('a:eq(0) span',$(n)).text();
$('#tabs').tabs('close',t);
});
return false;
});
//关闭当前左侧的TAB
$('#mm-tabcloseleft').click(function(){
var prevall = $('.tabs-selected').prevAll();
if(prevall.length==0){
alert('到头了,前边没有啦~~');
return false;
}
prevall.each(function(i,n){
var t=$('a:eq(0) span',$(n)).text();
$('#tabs').tabs('close',t);
});
return false;
}); //退出
$("#mm-exit").click(function(){
$('#mm').menu('hide');
})
} /*进度条*/
function progress(){
var win = $.messager.progress({
title:'请稍等',
msg:'正在加载数据...'
});
setTimeout(function(){
$.messager.progress('close');
},2000)
}

处理EasyUI中tab的切换问题以及accordion左侧导航栏的代码实现的更多相关文章

  1. easyui中Tab的tools按钮刷新当前tab

    easyui中Tab的tools按钮刷新当前tab 点击刷新按钮,刷新当前Tab选项卡. $('#index_tabs').tabs({ fit : true, border : false, too ...

  2. 使用vue封装一个tab栏切换的左侧导航栏的公共组件

     首先看最终效果图: 1.compent文件夹里添加tab文件夹,里面创建index.vue index.js index.css index.vue内的template部份代码如下:(最新更正:代码 ...

  3. jquery easyui 中tab页添加其他页面,href与content的用法与区别

    //tab页增加 function addPanel(name,url){ var dd = $('#tt').tabs('exists',name); if(dd){ $('#tt').tabs(' ...

  4. easyui中tab页中js脚本无法加载的问题及解决方法

    我发现tab页中<script src="xxx.js">方式加载的脚本没有生效,firebug看请求也没有请求相应的脚本文件. 单独在浏览器中打开tab页中的页面js ...

  5. 网页中tab标签切换分别用jquery和javascript源码实现

    //HTML布局<ul id="tabTitle"> <li class="active">HTML5</li> <l ...

  6. vant中tab标签切换时会改变内容滚动高度

    vant的tabs标签页,标签切换时会改变内容区的滚动高度,这是因为内容区共用同一个父元素为滚动区域引起的,解决办法:在tabs的内容区域嵌套一层滚动区域,让每个内容区域使用单独的滚动元素就行了.   ...

  7. adjustResize模式下ExpandaleListView中输入框焦点错乱及布局底部的导航栏被顶在键盘上方的处理

    为了更好的用户体验,煎熬了许久,得到这么个解决方案.在此记录下来,以供后来者参考. 第一部分 清单文件中组件activity的android:windowSoftInputMode属性值的含义: [A ...

  8. easyUI框架之学习2--添加左侧导航栏

    <head> function addTab(title, url) { if ($('#tableContainer').tabs('exists', title)) { $('#tab ...

  9. uni-app中实现左侧导航栏效果

    HTML: 1 <view class="list"> 2 <!-- 一级 --> 3 <scroll-view class="list-l ...

随机推荐

  1. 扩展的方法:es6 安装模块builder

    https://github.com/es-shims/es5-shim/ Image.png 检测浏览器可支持es5,不支持就扩展,做兼容: 扩展的方法: Image.png 取所有对象的键值: o ...

  2. 【Codeforces Round #301 (Div. 2) A】 Combination Lock

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟水题 [代码] #include <bits/stdc++.h> using namespace std; cons ...

  3. 洛谷——P1089 津津的储蓄计划

    https://www.luogu.org/problem/show?pid=1089 https://www.luogu.org/problem/show?pid=1089 题目描述 津津的零花钱一 ...

  4. POJ 3259 Wormholes 邻接表的SPFA判断负权回路

    http://poj.org/problem?id=3259 题目大意: 一个农民有农场,上面有一些虫洞和路,走虫洞可以回到 T秒前,而路就和平常的一样啦,需要花费时间走过.问该农民可不可能从某个点出 ...

  5. AdminLTE的使用(转)

    官方文档link1.AdminLTE的必要配置文件<!-- Tell the browser to be responsive to screen width --> <meta c ...

  6. PostgreSQL 序列

    PostgreSQL 中的序列是一个数据库对象,本质上是一个自增器.因此,序列在其他同类型数据库软件中以 autoincrment 值的形式存在.在一张表需要非随机,唯一标实符的场景下,Sequenc ...

  7. complex query几个原则

    1.一般来说in比exists更有利(更容易变成join). 2.尽量避免union,使用union all代替,避免sort. 3,绝对不能在没有on条件下使用join(除非有特殊目的). 4.ou ...

  8. MySQL5.7 四种日志文件

    mysql 日志包括:错误日志,二进制日志,通用查询日志,慢日志等 一:通用查询日志: 记录建立的客户端连接和执行的语句 1)show variables like '%verision%'; 显示数 ...

  9. [Angular] Test Container component with async provider

    The main idea for testing contianer component is to make sure it setup everythings correctlly. Call ...

  10. 终端复用工具tmux的使用

    tmux的作用在于终端复用. 1. 在server上启动一个bash.并在里面执行tmux 2. 通过ssh远程登录server,执行tmux attach,就会切换到server上的那个bash中, ...