feat: 增加首頁評論數顯示

fix: 修復點擊toc後,滾動完toc的highlight在點擊的上一個元素
fix: 修復打賞按鈕Hover的bug close #473
improvement: 友情鏈接界面增加title顯示(top_img設為false時)
improvement: 優化toc顯示,當向上滾動時,導航欄不會遮擋 toc close #472
improvement: 升級facebook comment sdk版本
This commit is contained in:
Jerry
2021-01-25 19:39:53 +08:00
parent d33dc5551c
commit 6962353af6
27 changed files with 400 additions and 237 deletions

View File

@@ -315,7 +315,7 @@ document.addEventListener('DOMContentLoaded', function () {
let initTop = 0
let isChatShow = true
const $nav = document.getElementById('nav')
const $header = document.getElementById('page-header')
const isChatBtnHide = typeof chatBtnHide === 'function'
const isChatBtnShow = typeof chatBtnShow === 'function'
window.addEventListener('scroll', btf.throttle(function (e) {
@@ -323,25 +323,25 @@ document.addEventListener('DOMContentLoaded', function () {
const isDown = scrollDirection(currentTop)
if (currentTop > 56) {
if (isDown) {
if ($nav.classList.contains('visible')) $nav.classList.remove('visible')
if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible')
if (isChatBtnShow && isChatShow === true) {
chatBtnHide()
isChatShow = false
}
} else {
if (!$nav.classList.contains('visible')) $nav.classList.add('visible')
if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible')
if (isChatBtnHide && isChatShow === false) {
chatBtnShow()
isChatShow = true
}
}
$nav.classList.add('fixed')
$header.classList.add('nav-fixed')
if (window.getComputedStyle($rightside).getPropertyValue('opacity') === '0') {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
}
} else {
if (currentTop === 0) {
$nav.classList.remove('fixed', 'visible')
$header.classList.remove('nav-fixed', 'nav-visible')
}
$rightside.style.cssText = "opacity: ''; transform: ''"
}
@@ -448,7 +448,7 @@ document.addEventListener('DOMContentLoaded', function () {
let currentIndex = ''
list.forEach(function (ele, index) {
if (top > btf.getEleTop(ele) - 70) {
if (top > btf.getEleTop(ele) - 80) {
currentId = '#' + encodeURI(ele.getAttribute('id'))
currentIndex = index
}