提交 bec8b762 编写于 作者: T Tintin

template: add footer.

上级 98568fca
......@@ -178,6 +178,12 @@
<div id="main">
<div class="tabs" id="tabs-container"></div>
</div>
<footer id="footer">
<ol class="breadcrumb">
<li class="active">Z-Master</li>
<li class="active">首页</li>
</ol>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zui/1.9.2/lib/jquery/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zui/1.9.2/js/zui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zui/1.9.2/lib/tabs/zui.tabs.js"></script>
......
......@@ -16,6 +16,7 @@ $('#tabs-container').tabs({
forbidClose: true
}]
});
let breadcrumbPath = [];
const tabsInstance = $('#tabs-container').data('zui.tabs');
// Click on the left navigation bar to link with the tab page
$('#treeMenu').on('click', 'a', function () {
......@@ -25,6 +26,8 @@ $('#treeMenu').on('click', 'a', function () {
}
const tabName = $(this).text();
const tabId = $(this).closest('li').data('id');
breadcrumbPath = [];
setBreadcrumbPath($(this));
if (Object.keys(tabsInstance.tabs).includes(tabName)) {
$(`#tab-nav-item-${tabName} .tab-nav-link`).trigger('click');
return;
......@@ -48,6 +51,8 @@ $('#treeMenu').on('click', 'a', function () {
function activeMenuItem(activeTabId) {
$('#treeMenu li.active').removeClass('active');
$(`#treeMenu li[data-id=${activeTabId}] a`).closest('li').addClass('active');
breadcrumbPath = [];
setBreadcrumbPath($(`#treeMenu li[data-id=${activeTabId}] a`));
const hasLists = $('#treeMenu li.active').parents('li.has-list');
if(hasLists.length !== 0) {
hasLists.each(function() {
......@@ -56,6 +61,24 @@ function activeMenuItem(activeTabId) {
}
}
/**
* set breadcrumb
* @param {JQuery<HTMLElement>} $a
*/
function setBreadcrumbPath($a) {
let $lis = $a.parents('li');
$lis.each(function(index, li) {
breadcrumbPath.unshift($(li).children('a').text());
});
const $breadcrumb = $('#footer .breadcrumb');
$breadcrumb.empty();
const breadcrumbItem = [];
breadcrumbPath.forEach((x, index) => {
breadcrumbItem.push($(`<li class="active">${x}</li>`));
});
$breadcrumb.append($('<li class="active">Z-Master</li>'), ...breadcrumbItem);
}
// Click on the tab page to link with the left navigation bar
$('#tabs-container').on('click', '.tab-nav-link', function () {
activeMenuItem($(this).data('id'));
......
......@@ -205,7 +205,7 @@ body {
position: fixed;
z-index: 1;
top: 50px;
bottom: 0;
bottom: 36px;
left: 0;
overflow: hidden;
width: 230px;
......@@ -258,7 +258,7 @@ body {
right: 0;
bottom: 0;
left: 230px;
padding: 0 10px;
padding: 0 10px 40px 10px;
transition: left .5s ease-in-out;
background-color: @main-bgcolor;
}
......@@ -267,4 +267,25 @@ body {
min-height: 100%;
}
/* main end */
\ No newline at end of file
/* main end */
/* footer start */
#footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
background: #fff;
.breadcrumb {
margin-bottom: 0;
li:not(:first-child) {
&::before {
content: '>';
}
}
}
}
/* footer end */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册