zoukankan      html  css  js  c++  java
  • EasyUI Tabs绑定右键

    JS:

                /*为选项卡绑定右键*/
                    $("#tabs").tabs({
                        onContextMenu function(e) {
                            /* 选中当前触发事件的选项卡 */
                            var subtitle $(this).text();
                            $('#tabs').tabs('select', subtitle);
                            //显示快捷菜单
                            e.preventDefault();
                            //阻止冒泡
                            $('#menu').menu('show', {
                                left e.pageX,
                                top e.pageY
                            });
                            return false;
                        }
                    })

                //刷新
                $("#m-refresh").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');    //获取选中的标签项
                    var url = $(currTab.panel('options').content).attr('src');    //获取该选项卡中内容标签(iframe)的 src 属性                 
                    if (url == null) {
                        /* 重新设置该标签 */
                        $('#tabs').tabs('update', {
                            tab: currTab,
                            options: {
                                content: '<iframe frameborder="0"  src="Tabs/Monitoring/MonitoringOfMapType.aspx" style="height: 100%;  100%;" ></iframe>'//如果用herf,容易导致样式与主页面重载,导致页面奔溃.
                            }
                        })
                    }
                    else {
                        /* 重新设置该标签 */
                        $('#tabs').tabs('update', {
                            tab: currTab,
                            options: {
                                content: '<iframe frameborder="0"  src="' + url + '"  style="height: 100%;  100%;" ></iframe>'//如果用herf,容易导致样式与主页面重载,导致页面奔溃.
                            }
                        })
                    }
                });
                //关闭所有
                $("#m-closeall").click(function () {
                    $(".tabs li").each(function (i, n) {
                        var title = $(n).text();
                        if (title != '主页') {//非主页全部关闭
                            $('#tabs').tabs('close', title);
                        }
                    });
                });
                //除当前之外关闭所有
                $("#m-closeother").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');
                    currTitle = currTab.panel('options').title;
                    $(".tabs li").each(function (i, n) {
                        var title = $(n).text();
                        if (currTitle != title && title != '主页') {//除本页和主页以外全部关闭
                            $('#tabs').tabs('close', title);
                        }
                    });
                });
                //关闭当前
                $("#m-close").click(function () {
                    var currTab = $('#tabs').tabs('getSelected');
                    currTitle = currTab.panel('options').title;
                    $('#tabs').tabs('close', currTitle);
                });

    html:

    <%--右键菜单--%>
        <div id="menu" class="easyui-menu" style="width: 150px;">
            <div id="m-refresh" data-options="iconCls:'icon-reload'">
                刷新</div>
            <div class="menu-sep" data-options="iconCls:''">
            </div>
            <div id="m-closeall" data-options="iconCls:''">
                全部关闭</div>
            <div id="m-closeother" data-options="iconCls:''">
                关闭其他</div>
            <div class="menu-sep">
            </div>
            <div id="m-close" data-options="iconCls:'icon-no'">
                关闭</div>
        </div>





  • 相关阅读:
    .net AJAX运行错误 未能加载文件或程序集 "System.Web....”的解决办法
    mysql免安装版使用方法
    XP下IIS+php 5.2.4配置
    distinct order by
    手机操作系统介绍
    .net自带 SQL Server 2005 Express使用
    统计字符串数组中每个字符串所出现的次数
    juqery 学习之三 选择器<层级><基本>
    juqery 学习之三 选择器<简单><内容>
    juqery 学习之三 选择器<可见性><元素属性>
  • 原文地址:https://www.cnblogs.com/nangong/p/4676079.html
Copyright © 2011-2022 走看看