当前位置:网站首页>Handwritten background management framework template (I)
Handwritten background management framework template (I)
2022-06-26 06:03:00 【Source code Xiao Liu】
introduction : Some time ago, Xiao Liu always wanted to write his own background management template , There is no need to go online to find a framework combination . Now Xiao Liu has taken the time to write a simple template version 1.0 Then I have time to optimize .
The home page of the background management framework generally has header users and system information , The menu bar is mostly on the left , On the right is the content display area . The right side may be divided into two parts , One part is the tab , One part is the content area ;
The main ideas are as follows :
1. Click the menu on the left to display the contents on the right , At the same time, the corresponding label tab appears above the content
2. Click the tab to return to the corresponding content page
3. Click Delete to display the last content area
4. The left menu and the header tab should correspond one by one , While visually active Sync
The above is the form of general background management framework template , It is also the difficulty in the implementation of the template ;
Xiao Liu's simple implementation results are as follows :

The above is what Xiao Liu achieved , Here are some core codes :
difficulty : Or how to find the corresponding menu , Tags and content pages ; If you can find it, it is not difficult to understand ; What Xiao Liu adopted iframe Form sub page ; obtain a Of the link data-href and data-index Operate accordingly ;
Click the tab to generate the corresponding tab content
/**
* Click event in the left menu
*/
$(".liu_first_munu").siblings().find("a").click(function () {
$(this).parent().parent().siblings().find("a").removeClass("liu_nav_active")
$(this).addClass("liu_nav_active");
$(this).parent().siblings().children().removeClass("liu_nav_active")
let text = $(this).text();
let href = $(this).attr("data-href");
let index = $(this).attr("data-index");
var n = '<iframe name="iframe_' + index + '" width="100%" height="580px" src="' + href + '" data-index="' +
index + '"></iframe>';
var a = '<a href="javascript:;" class="liu_nav_active" data-href="' + href + '" data-index="' + index + '">' +
text +
"<i class='glyphicon glyphicon-remove liu_remove' data-href=" + href + " data-index=" + index + "></i>"
'</a>';
let im_flag = true;
$(".liu_iframes iframe").each(function (index_iframe, element) {
if ($(element).attr("data-index") == index) {
$(element).siblings().hide();
$(element).show();
im_flag = false;
}
});
if (im_flag) {
if ($(".liu_nav_top_tab a").length >= 6) {
alert(" Up to... Can be loaded 6 Tabs ! Please close other tabs first !")
return false;
}
$(".liu_iframes").children().hide();
$(".liu_iframes").append(n);
}
let flag = true;
$(".liu_nav_top_tab a").each(function (index_tab, element) {
if ($(element).attr("data-index") == index) {
$(element).addClass("liu_nav_active");
$(element).siblings().removeClass("liu_nav_active");
flag = false;
}
})
if (flag) {
$(".liu_nav_top_tab a").removeClass("liu_nav_active");
$(".liu_nav_top_tab").append(a)
}
});Click the tab to enter the corresponding tab
/**
* Header tab click event
*/
$(".liu_nav_top_tab").on("click", "a", function () {
$(this).addClass("liu_nav_active");
$(this).siblings().removeClass("liu_nav_active")
let text = $(this).text();
let href = $(this).attr("data-href");
let index = $(this).attr("data-index");
$(".liu_iframes iframe").each(function (index_iframe, element) {
if ($(element).attr("data-index") == index) {
$(element).siblings().hide();
$(element).show();
}
});
$(".liu_nav_left li a").each(function (index_tab, element) {
if ($(element).attr("data-index") == index) {
$(this).addClass("liu_nav_active");
$(this).parent().siblings().children().removeClass("liu_nav_active")
$(this).parent().parent().siblings().find("a").removeClass("liu_nav_active")
}
})
});Click Delete to delete the corresponding tab
/*
* Header delete tab
*/
$(".liu_nav_top_tab").on("click", "i", function (event) {
let index = $(this).attr("data-index");
$(".liu_iframes iframe").each(function (index_iframe, element) {
if ($(element).attr("data-index") == index) {
$(element).siblings().last().show();
$(element).remove();
}
});
$(this).parent().remove();
event.stopPropagation();
var ifram = $(".liu_iframes iframe")[$(".liu_iframes iframe").length - 1];
var ac_index = $(ifram).attr("data-index");
$(".liu_nav_left li a").each(function (index_tab, element) {
if ($(element).attr("data-index") == index) {
$(this).removeClass("liu_nav_active");
}
if ($(element).attr("data-index") == ac_index) {
$(this).addClass("liu_nav_active");
}
})
});Code is redundant , You can optimize it later ;
If there is any confusion , Please add java Like to communicate with others :852665736; The group is full of hospitable friends , Let's make progress together .
Free sharing of source code, technology and interview documents , For more excellent and exquisite source code technology stack sharing, please follow wechat official account :gh_817962068649
边栏推荐
- REUSE_ ALV_ GRID_ Display event implementation (data_changed)
- SQL server functions
- numpy.frombuffer()
- Sql语法中循环的使用
- Kolla ansible deploy openstack Yoga version
- 电商借助小程序技术发力寻找增长突破口
- 06. talk about the difference and coding between -is and = = again
- Ribbon load balancing service call
- Yamaha robot splits visual strings
- Given two corresponding point sets AB, how to estimate the parameters of the specified transformation matrix R?
猜你喜欢

421- binary tree (226. reversed binary tree, 101. symmetric binary tree, 104. maximum depth of binary tree, 222. number of nodes of complete binary tree)

小程序第三方微信授权登录的实现

kolla-ansible部署openstack yoga版本

MySQL-08

MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

5分钟包你学会正则表达式

Adapter mode

Redis多线程与ACL

Tencent WXG internship experience (has offered), I hope it will help you!

E-commerce seeks growth breakthrough with the help of small program technology
随机推荐
Unicloud cloud development obtains applet user openid
Easy to understand from the IDE, and then talk about the applet IDE
pytorch(环境、tensorboard、transforms、torchvision、dataloader)
Bingc (inheritance)
06. talk about the difference and coding between -is and = = again
Cython入门
Func < T, tresult > Commission - learning record
numpy.exp()
REUSE_ALV_GRID_DISPLAY 事件实现(DATA_CHANGED)
04. basic data type - list, tuple
Test depends on abstraction and does not depend on concrete
How Navicat reuses the current connection information to another computer
原型模式,咩咩乱叫
SQL Server view
Household accounting procedures (the second edition includes a cycle)
one billion two hundred and twelve million three hundred and twelve thousand three hundred and twenty-one
Redis多线程与ACL
Feelings of virtual project failure
NPM private server problem of peanut shell intranet penetration mapping
numpy. log