How to close tabs in bootstrap: 1. Introduce jquery; 2. Reference the "bootstrap-closable-tab" plug-in in the corresponding page; 3. Pass "closeTab:function(item){...}" This method can achieve the effect of closing tabs.
#The operating environment of this article: Windows7 system, bootstrap3, Dell G3 computer.
Bootstrap comes from Twitter and is currently the most popular front-end framework. Bootstrap is based on HTML, CSS, and JavaScript, and it is simple and flexible. During the development process, we only need to add the corresponding class to the DOM element to call it, making Web development faster.
How can bootstrap close tabs?
I found a tab plug-in that can be closed from the Internet: bootstrap-closable-tab plug-in
Reference the bootstrap-closable-tab plug-in in the page to achieve closeability tab page effect.
1. The bootstrap-closable-tab component is a component that can close tab tabs. It is based on jquery and bootstrap; therefore, bootstrap related plug-ins must be introduced.
The prerequisite is to introduce jquery:
2. Introduce the plug-in:
The code is as follows:
//子页面不用iframe,用div展示 var closableTab = { //添加tab addTab:function(tabItem){ //tabItem = {id,name,url,closable} var id = "tab_seed_" + tabItem.id; var container ="tab_container_" + tabItem.id; $("li[id^=tab_seed_]").removeClass("active"); $("div[id^=tab_container_]").removeClass("active"); if(!$('#'+id)[0]){ var li_tab = '
3. HTML code:
4. The usage method is as follows:
var item = {'id':'1','name':'菜单管理','url':'./menuctrl.html','closable':false}; closableTab.addTab(item);
Recommended: "bootstrap tutorial》
The above is the detailed content of How to close tab in bootstrap. For more information, please follow other related articles on the PHP Chinese website!