[opt] update

This commit is contained in:
xaoxuu 2022-12-16 23:45:36 +08:00
parent fffc16463a
commit c4ed1926ce
4 changed files with 23 additions and 4 deletions

View File

@ -32,7 +32,7 @@ a.button.start.gradient
background: convert(hexo-config('style.gradient.start'))
background-size: 1000%
color: white
animation: glow 60s linear forwards
animation: glow 60s linear infinite
@keyframes glow {
from {
background-position: 0%

View File

@ -3,6 +3,7 @@
padding: 0.25rem 1rem
border-radius: $border-block
background: var(--theme-bg2)
overflow: hidden
if hexo-config('tag_plugins.note.border') == true
border: 1px solid var(--theme-border)
color: var(--text-p1)
@ -46,7 +47,6 @@
margin-top: .5rem
.md-text .tag-plugin.note[child=iframe]
overflow: hidden
padding: 0
>.body
margin: 0

View File

@ -22,7 +22,7 @@
border-radius: 4px
background: convert(hexo-config('style.gradient.search'))
background-size: 200%
animation: glow 10s linear forwards
animation: glow 10s linear infinite
@keyframes glow {
from {
background-position: 0%

View File

@ -95,6 +95,13 @@ const init = {
$("article.md-text :header").each(function (idx, node) {
segs.push(node)
});
// 定位到激活的目录树不如pjax体验好
// const widgets = document.querySelector('.widgets')
// const e1 = document.querySelector('.doc-tree-link.active')
// const offsetTop = e1.getBoundingClientRect().top - widgets.getBoundingClientRect().top - 100
// if (offsetTop > 0) {
// widgets.scrollBy({top: offsetTop, behavior: 'smooth'})
// }
// 滚动
$(document, window).scroll(function (e) {
var scrollTop = $(this).scrollTop();
@ -114,7 +121,19 @@ const init = {
$("#data-toc a.toc-link").removeClass("active")
var link = "#" + topSeg.attr("id")
if (link != '#undefined') {
$('#data-toc a.toc-link[href="' + encodeURI(link) + '"]').addClass("active")
const highlightItem = $('#data-toc a.toc-link[href="' + encodeURI(link) + '"]')
if (highlightItem.length > 0) {
highlightItem.addClass("active")
const e0 = document.querySelector('.widgets')
const e1 = document.querySelector('#data-toc a.toc-link[href="' + encodeURI(link) + '"]')
const offsetBottom = e1.getBoundingClientRect().bottom - e0.getBoundingClientRect().bottom + 100
const offsetTop = e1.getBoundingClientRect().top - e0.getBoundingClientRect().top - 80
if (offsetTop < 0) {
e0.scrollBy(0, offsetTop)
} else if (offsetBottom > 0) {
e0.scrollBy(0, offsetBottom)
}
}
} else {
$('#data-toc a.toc-link:first').addClass("active")
}