mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40:53 +08:00
🐛 修復上次更新導致頁面跳動的bug
This commit is contained in:
@@ -532,11 +532,11 @@ $(function () {
|
|||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateAnchor = function (anchor) {
|
// function updateAnchor (anchor) {
|
||||||
if (anchor !== window.location.hash) {
|
// if (window.history.replaceState && anchor !== window.location.hash) {
|
||||||
location.replace(window.location.href.split('#')[0] + anchor)
|
// window.history.replaceState(null, null, anchor)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// find head position & add active class
|
// find head position & add active class
|
||||||
// DOM Hierarchy:
|
// DOM Hierarchy:
|
||||||
@@ -565,7 +565,7 @@ $(function () {
|
|||||||
|
|
||||||
var currentActive = $('.toc-link.active')
|
var currentActive = $('.toc-link.active')
|
||||||
if (currentId && currentActive.attr('href') !== currentId) {
|
if (currentId && currentActive.attr('href') !== currentId) {
|
||||||
updateAnchor(currentId)
|
// updateAnchor(currentId)
|
||||||
|
|
||||||
$('.toc-link').removeClass('active')
|
$('.toc-link').removeClass('active')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user