mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
1. Feature: the sidebar can auto scroll when the toc out of the screen
2. Fix: When the picture is loaded, the picture appears black frame
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
.card_widget.card-categories
|
||||
if site.categories.length
|
||||
.card_widget.card-categories
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-folder-open(aria-hidden="true")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
.card_widget.card-tags
|
||||
if site.tags.length
|
||||
.card_widget.card-tags
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-tags(aria-hidden="true")
|
||||
|
||||
@@ -351,3 +351,8 @@ table
|
||||
position: fixed
|
||||
z-index: -1
|
||||
pointer-events: none
|
||||
|
||||
|
||||
// 去掉加載黑框
|
||||
img[src=""],img:not([src])
|
||||
opacity: 0
|
||||
|
||||
@@ -285,6 +285,7 @@ $(function () {
|
||||
$(".toggle-menu *").css({ 'background-color': '#3b3a3a', 'text-shadow': 'none' });
|
||||
$('body').addClass("is_hidden");
|
||||
$('.menus').addClass("menu_open");
|
||||
fixbg_menu();
|
||||
} else {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
|
||||
@@ -298,6 +299,7 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
function fixbg_menu() {
|
||||
const fixScroll = (scrollEl) => {
|
||||
let startY
|
||||
scrollEl.addEventListener('touchstart', function (event) {
|
||||
@@ -333,6 +335,8 @@ $(function () {
|
||||
}
|
||||
const scrollEl = document.querySelector(".menus");
|
||||
fixScroll(scrollEl)
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(window).on('resize', function (e) {
|
||||
@@ -515,6 +519,18 @@ $(function () {
|
||||
// Hide their respective list of subsections
|
||||
.find('.toc-child').hide()
|
||||
}
|
||||
|
||||
if ($('.toc-link').hasClass('active')){
|
||||
var active_position = $(".active").offset().top;
|
||||
var sidebar_scrolltop = $("#sidebar").scrollTop();
|
||||
if (active_position > (top + $(window).height() - 50)) {
|
||||
$("#sidebar").scrollTop(sidebar_scrolltop + 100);
|
||||
} else if (active_position < top + 50)
|
||||
{
|
||||
$("#sidebar").scrollTop(sidebar_scrolltop - 100);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//代碼框雙擊全屏
|
||||
|
||||
Reference in New Issue
Block a user