当前位置:网站首页>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
边栏推荐
- Explore small program audio and video calls and interactive live broadcast from New Oriental live broadcast
- Household accounting procedures (the second edition includes a cycle)
- Day4 branch and loop
- REUSE_ALV_GRID_DISPLAY 事件实现(DATA_CHANGED)
- numpy.tile()
- 05. basic data type - Dict
- Pytorch (network model training)
- tf.nn.top_k()
- Hot! 11 popular open source Devops tools in 2021!
- 423-二叉树(110. 平衡二叉树、257. 二叉树的所有路径、100. 相同的树、404. 左叶子之和)
猜你喜欢

Redis底层数据结构

MySQL-09

Hot! 11 popular open source Devops tools in 2021!

电商借助小程序技术发力寻找增长突破口

Gram 矩阵
![Selective search for object recognition paper notes [image object segmentation]](/img/cf/d3b08d41083f37c164b26a96b989c9.png)
Selective search for object recognition paper notes [image object segmentation]

Selective Search for Object Recognition 论文笔记【图片目标分割】

Test depends on abstraction and does not depend on concrete

原型模式,咩咩乱叫

Keepalived to achieve high service availability
随机推荐
Summary of JVM interview focus (II) -- garbage collector (GC) and memory allocation strategy
Unicloud cloud development obtains applet user openid
Household accounting procedures (the second edition includes a cycle)
Static proxy mode
Feelings of virtual project failure
Test depends on abstraction and does not depend on concrete
Interface oriented programming
Adapter mode
Last flight
Record how to modify the control across threads
Force buckle 875 Coco, who likes bananas
Thinking about bad money expelling good money
Day4 branch and loop
Posting - don't get lost in the ocean of Technology
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
Definition of Halcon hand eye calibration
SQL Server view
状态模式,身随心变
家庭记账程序(第一版)
Consul service registration and discovery