Home Web Front-end JS Tutorial How to add a right-click menu to the EasyUI Tab label_jquery

How to add a right-click menu to the EasyUI Tab label_jquery

May 16, 2016 pm 05:52 PM
easyui tab label right click menu

Preparatory work in the early stage:
1. Download the DEMO source code and upgrade to the latest version (jquery 1.7.2, Easyui 1.2.6). Just replace it directly. When upgrading easyui, you need to replace all css js theme
2. In the HTML code of the home page: Copy the code

to the following code: < ;div id="mm" class="easyui-menu" style="width:150px;">
Refresh
< div class="menu-sep">

Close


Close all except this




is changed to:


Copy the code The code is as follows:
Refresh

Close


Close all except this




Add a new method in outlook2.js as follows:


Copy the code The code is as follows: function closeTab(action)
{
var alltabs = $('#tabs').tabs('tabs');
var currentTab =$('#tabs').tabs(' getSelected');
var allTabtitle = [];
$.each(alltabs,function(i,n){
allTabtitle.push($(n).panel('options').title) ;
})
switch (action) {
case "refresh":
var iframe = $(currentTab.panel('options').content);
var src = iframe. attr('src');
$('#tabs').tabs('update', {
tab: currentTab,
options: {
content: createFrame(src)
}
})
break;
case "close":
var currtab_title = currentTab.panel('options').title;
$('#tabs').tabs(' close', currtab_title);
break;
case "closeall":
$.each(allTabtitle, function (i, n) {
if (n != onlyOpenTitle){
$ ('#tabs').tabs('close', n);
}
});
break;
case "closeother":
var currtab_title = currentTab.panel(' options').title;
$.each(allTabtitle, function (i, n) {
if (n != currtab_title && n != onlyOpenTitle)
{
$('#tabs' ).tabs('close', n);
}
});
break;
case "closeright":
var tabIndex = $('#tabs').tabs( 'getTabIndex', currentTab);
if (tabIndex == alltabs.length - 1){
alert('Dear, there is nothing behind it^@^!!');
return false;
}
$.each(allTabtitle, function (i, n) {
if (i > tabIndex) {
if (n != onlyOpenTitle){
$('#tabs'). tabs('close', n);
}
}
});
break;
case "closeleft":
var tabIndex = $('#tabs'). tabs('getTabIndex', currentTab);
if (tabIndex == 1) {
alert('Dear, there's someone in front of you, we can't afford to offend him. ^@^!!');
return false;
}
$.each(allTabtitle, function (i, n) {
if (i < tabIndex) {
if ( n != onlyOpenTitle){
$('#tabs').tabs('close', n);
}
}
});
break;
case " exit":
$('#closeMenu').menu('hide');
break;
}
}


Change the tabCloseEven method in js to


Copy code The code is as follows: function tabCloseEven() {
$('# mm').menu({
onClick: function (item) {
closeTab(item.id);
}
});
return false;
}


This is OK, the code is much more elegant than before!
When calling refresh and closing the current tab, call closeTab('action') //action can be refresh (refresh) or close (close)
When used in an iframe, do this top.closeTab('action ');
Click here to download the latest Easyui application example
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the slow response of Win11 right-click menu? Solution to the slow pop-up menu of right-clicking the mouse in Win11 How to solve the slow response of Win11 right-click menu? Solution to the slow pop-up menu of right-clicking the mouse in Win11 Jan 31, 2024 pm 10:06 PM

After upgrading the Win11 system, some friends found that the pop-up menu when right-clicking the mouse has become slower. What is going on? Is it because of the configuration problem, or what kind of settings should be made? The editor of this website will tell you how to solve it today. In fact, we can adjust the performance to the highest performance, so that there will be no problem of slow response. Solution to the slow right-click pop-up menu of Win11 1. First, find the system settings in the start menu. 3. Then find the advanced system settings in the relevant links below. 5. Then under the visual effects tab, check Adjust for best performance.

What should I do if there is no compressed package option when right-clicking on Windows 10? What should I do if there is no compressed package option when right-clicking on Windows 10? Jul 13, 2023 pm 11:05 PM

Win10 system has built-in decompression software WinRAR. Generally, you can find the shrink option by right-clicking on the folder. However, some users find that there is no compressed package option when they right-click. What should they do? You first find WinRAR in the menu bar to open, then click the option above, then select Settings, switch to the integrated menu bar in the opening window, click the context menu button, and check "Add to archive". What to do if there is no compressed package option in win10: You can click the "Start/WinRar/Winrar" menu items on the Windows 10 desktop. At this time, the main interface of Winrar software will open, click on the "Options" menu item above. In the drop-down list of options that pops up, click "Settings"

How to add a drawing program to the right-click menu of Win11? How to add a drawing program to the right-click menu of Win11 How to add a drawing program to the right-click menu of Win11? How to add a drawing program to the right-click menu of Win11 Feb 11, 2024 pm 09:03 PM

Many win11 users want to add their drawing program to the right-click menu, so how do they add it? Users can directly right-click the Windows Terminal under Start, and then directly copy the following code to the corresponding location. Let this site carefully introduce to users how to add a drawing program to the Win11 right-click menu. How to add a drawing program to the Win11 right-click menu 1. First, right-click the "Start" button (or press the Win+X keys) and select "Windows Terminal (Administrator)". 2. Then paste this string of code into the terminal application [reg.exeadd&ldqu

How to solve the problem of stuck right-click menu of win11 file How to solve the problem of stuck right-click menu of win11 file Jul 02, 2023 pm 11:13 PM

How to solve the problem of stuck right-click menu of win11 files? What should I do if I need to view the specific attributes of a file? We often left-click to select a file and then right-click to open the menu to view properties. However, many friends who use the win11 version of the operating system often encounter that when right-clicking on a file, they always have to wait for a while before the right-click menu is displayed. This has a great impact on users' computer experience. In this regard, the editor uses the following article to introduce how to solve this problem. Many friends don’t know how to operate in detail. The editor below has compiled a tutorial on how to solve the problem of Win11 right-click menu being stuck. If you are interested, follow the editor and take a look below! Overview of the tutorial on how to fix the stuck win11 right-click menu 1. First, we press [ctr] at the same time

What to do if the right-click menu management cannot be opened in Windows 10 What to do if the right-click menu management cannot be opened in Windows 10 Jan 04, 2024 pm 07:07 PM

When we use the win10 system, when we use the mouse to right-click the desktop or the right-click menu, we find that the menu cannot be opened and we cannot use the computer normally. At this time, we need to restore the system to solve the problem. Win10 right-click menu management cannot be opened: 1. First open our control panel, and then click. 2. Then click under Security and Maintenance. 3. Click on the right to restore the system. 4. If it still cannot be used, check whether there is something wrong with the mouse itself. 5. If you are sure there is no problem with the mouse, press + and enter. 6. After the execution is completed, restart the computer.

Is easyui a jquery plug-in? Is easyui a jquery plug-in? Jul 05, 2022 pm 06:08 PM

easyui is a jquery plug-in. easyui is a front-end UI interface plug-in based on JQuery, which is used to help web developers more easily create feature-rich and beautiful UI interfaces. easyui is a framework that perfectly supports HTML5 web pages, which can help developers save the time and scale of web development.

Right click and create new word disappears Right click and create new word disappears Dec 25, 2023 am 10:43 AM

Many friends find that Word, ppt, and Excel in the list are missing when they right-click to create a new one. What is going on? In fact, some files are missing from the registration list. We only need to enter the settings to adjust the values. Okay, let’s take a look at the specific tutorial with the editor below. Method to fix the problem of missing right-click New Word 1. Click Start, find the run command line, enter regedit, and open the registry. 2. Find the HKEY_CLASSES_ROOT directory on the left and expand it. 3. First, we use the CTRL+F shortcut keys to find the location of "docx". Of course, you can also pull down and search by yourself. 4. Once found, there is no need to expand the directory. We can see that there is a (

Win11 mouse right-click menu setting tutorial Win11 mouse right-click menu setting tutorial Dec 23, 2023 am 11:05 AM

Since win11 has changed the mouse right-click menu, many friends feel uncomfortable using it. They want to know how to set up the win11 mouse right-click menu. In fact, we only need to open the registry, where we can edit the right-click menu. How to set the mouse right-click menu in win11: 1. First press "Win+R" on the keyboard to open run. 2. Enter "regedit" and press Enter to open the registry. 3. After opening, go to the "Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FeatureManagement\Overrides\4" location. 4. Then right-click the 4 folder and select New

See all articles