mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40: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,3 +1,4 @@
|
|||||||
|
if site.categories.length
|
||||||
.card_widget.card-categories
|
.card_widget.card-categories
|
||||||
.card-content
|
.card-content
|
||||||
.item_headline
|
.item_headline
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
if site.tags.length
|
||||||
.card_widget.card-tags
|
.card_widget.card-tags
|
||||||
.card-content
|
.card-content
|
||||||
.item_headline
|
.item_headline
|
||||||
|
|||||||
@@ -351,3 +351,8 @@ table
|
|||||||
position: fixed
|
position: fixed
|
||||||
z-index: -1
|
z-index: -1
|
||||||
pointer-events: none
|
pointer-events: none
|
||||||
|
|
||||||
|
|
||||||
|
// 去掉加載黑框
|
||||||
|
img[src=""],img:not([src])
|
||||||
|
opacity: 0
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ $(function () {
|
|||||||
$(".toggle-menu *").css({ 'background-color': '#3b3a3a', 'text-shadow': 'none' });
|
$(".toggle-menu *").css({ 'background-color': '#3b3a3a', 'text-shadow': 'none' });
|
||||||
$('body').addClass("is_hidden");
|
$('body').addClass("is_hidden");
|
||||||
$('.menus').addClass("menu_open");
|
$('.menus').addClass("menu_open");
|
||||||
|
fixbg_menu();
|
||||||
} else {
|
} else {
|
||||||
$(".toggle-menu").removeClass("close").addClass("open");
|
$(".toggle-menu").removeClass("close").addClass("open");
|
||||||
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
|
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
|
||||||
@@ -298,6 +299,7 @@ $(function () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function fixbg_menu() {
|
||||||
const fixScroll = (scrollEl) => {
|
const fixScroll = (scrollEl) => {
|
||||||
let startY
|
let startY
|
||||||
scrollEl.addEventListener('touchstart', function (event) {
|
scrollEl.addEventListener('touchstart', function (event) {
|
||||||
@@ -333,6 +335,8 @@ $(function () {
|
|||||||
}
|
}
|
||||||
const scrollEl = document.querySelector(".menus");
|
const scrollEl = document.querySelector(".menus");
|
||||||
fixScroll(scrollEl)
|
fixScroll(scrollEl)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(window).on('resize', function (e) {
|
$(window).on('resize', function (e) {
|
||||||
@@ -515,6 +519,18 @@ $(function () {
|
|||||||
// Hide their respective list of subsections
|
// Hide their respective list of subsections
|
||||||
.find('.toc-child').hide()
|
.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