zoukankan      html  css  js  c++  java
  • easyui tab 关闭

        <div id="mm" class="easyui-menu" style="150px;">
            <div id="mm-tabclose">关闭当前</div>    
            <div id="mm-tabcloseall">关闭全部</div>    
            <div id="mm-tabcloseother">关闭其他</div>    
            <div class="menu-sep"></div>    
            <div id="mm-tabcloseright">关闭右侧标签</div>    
            <div id="mm-tabcloseleft">关闭左侧标签</div>    
        </div>

    $(function() {
        $('#mainFrame').attr("src", "");
        bindTabEvent();    
        bindTabMenuEvent();    
    });

    function bindTabEvent(){  
        $('#mainTabs').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 bindTabMenuEvent() {
        
        $('#mm-tabclose').click(function() {    
            var currTab = $('#mainTabs').tabs('getSelected');
            currTitle = currTab.panel('options').title;    
            $('#mainTabs').tabs('close', currTitle);
        });    
        $('#mm-tabcloseall').click(function() {    
             $(".tabs li").each(function(i, n){
                 var title = $(n).text();
                 if(title!="首页"){
                     $('#mainTabs').tabs('close',title);
                 }
             });
        });    
        $('#mm-tabcloseother').click(function() {    
             var currTab = $('#mainTabs').tabs('getSelected');
             currTitle = currTab.panel('options').title;    
             $(".tabs li").each(function(i, n){
                 var title = $(n).text();
                 if(currTitle != title){
                     if(title!="首页"){
                         $('#mainTabs').tabs('close',title);
                     }
                 }
             });
        });    
        $('#mm-tabcloseright').click(function() {    
            var nextall = $('.tabs-selected').nextAll();    
            if (nextall.length == 0) {    
                alert('已经是最后一个了');    
                return false;    
            }    
            nextall.each(function(i, n) {    
                if ($('a.tabs-close', $(n)).length > 0) {    
                    var t = $('a:eq(0) span', $(n)).text();    
                    $('#mainTabs').tabs('close', t);    
                }    
            });    
            return false;    
        });    
        $('#mm-tabcloseleft').click(function() {    
            var prevall = $('.tabs-selected').prevAll();
            if (prevall.length == 1) {    
                alert('已经是第一个了');    
                return false;    
            }    
            prevall.each(function(i, n) {
                if ($('a.tabs-close', $(n)).length > 0) {    
                    var t = $('a:eq(0) span', $(n)).text();  
                    $('#mainTabs').tabs('close', t);    
                }    
            });    
            return false;    
        });    
    }

  • 相关阅读:
    hihoCoder 1092 : Have Lunch Together
    UVa 11401 三角形的个数
    2020杭电多校第一场 hdu6756 Finding a MEX
    2020杭电多校第二场 hdu6774 String Distance
    2020杭电多校第一场 hdu6759 Leading Robots
    2020牛客暑期多校训练营(第二场)A、B、C、D、F、G、H、J
    2020牛客暑期多校训练营(第二场)All with Pairs
    2020牛客暑期多校训练营(第二场)Boundary
    2020牛客暑期多校训练营(第二场)Just Shuffle
    2020牛客暑期多校训练营(第二场)Happy Triangle
  • 原文地址:https://www.cnblogs.com/ckaifeng/p/5009465.html
Copyright © 2011-2022 走看看