breaking changes: 移除 cnzz 分析

feat: 導航欄可隱藏博客名字
feat: 導航欄可設置 logo closed #1104
This commit is contained in:
Jerry
2022-12-22 00:16:54 +08:00
Unverified
parent e2565a9f39
commit 0f915f47ef
8 changed files with 43 additions and 28 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ a
if $site-name-font
#site-title,
#site-subtitle,
#site-name,
.site-name,
#aside-content .author-info__name,
#aside-content .author-info__description
font-family: $site-name-font
+18 -4
View File
@@ -137,8 +137,16 @@
box-shadow: 0 5px 6px -5px alpha($grey, .6)
transition: transform .2s ease-in-out, opacity .2s ease-in-out
#blog-info
color: var(--font-color)
&:hover
color: $light-blue
.site-name
text-shadow: none
a,
#site-name,
#toggle-menu
color: var(--font-color)
text-shadow: none
@@ -253,8 +261,15 @@
&.show
opacity: 1
#blog_name
#blog-info
flex: 1
color: var(--light-grey)
@extend .limit-one-line
.site-icon
margin-right: 6px
height: 36px
vertical-align: middle
#toggle-menu
display: none
@@ -270,10 +285,9 @@
&:hover
color: var(--white)
#site-name
.site-name
text-shadow: 2px 2px 4px rgba($dark-black, .15)
font-weight: bold
cursor: pointer
.menus_items
display: inline
+12 -9
View File
@@ -1,21 +1,24 @@
document.addEventListener('DOMContentLoaded', function () {
let blogNameWidth, menusWidth, searchWidth, $nav
let headerContentWidth, $nav
let mobileSidebarOpen = false
const adjustMenu = (init) => {
const adjustMenu = init => {
const getAllWidth = ele => {
let width = 0
ele.length && Array.from(ele).forEach(i => { width += i.offsetWidth })
return width
}
if (init) {
blogNameWidth = document.getElementById('site-name').offsetWidth
const $menusEle = document.querySelectorAll('#menus .menus_item')
menusWidth = 0
$menusEle.length && $menusEle.forEach(i => { menusWidth += i.offsetWidth })
const $searchEle = document.querySelector('#search-button')
searchWidth = $searchEle ? $searchEle.offsetWidth : 0
const blogInfoWidth = getAllWidth(document.querySelector('#blog-info > a').children)
const menusWidth = getAllWidth(document.getElementById('menus').children)
headerContentWidth = blogInfoWidth + menusWidth
$nav = document.getElementById('nav')
}
let hideMenuIndex = ''
if (window.innerWidth <= 768) hideMenuIndex = true
else hideMenuIndex = blogNameWidth + menusWidth + searchWidth > $nav.offsetWidth - 120
else hideMenuIndex = headerContentWidth > $nav.offsetWidth - 120
if (hideMenuIndex) {
$nav.classList.add('hide-menu')