增加模板

This commit is contained in:
2026-08-20 10:30:53 +08:00
parent 758f072494
commit 112d60b993
36 changed files with 16465 additions and 14 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+63
View File
@@ -0,0 +1,63 @@
(function () {
/*=====================================
Sticky
======================================= */
window.onscroll = function () {
var header_navbar = document.querySelector(".navbar-area");
var sticky = header_navbar.offsetTop;
if (window.pageYOffset > sticky) {
header_navbar.classList.add("sticky");
} else {
header_navbar.classList.remove("sticky");
}
// show or hide the back-top-top button
var backToTo = document.querySelector(".scroll-top");
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
backToTo.style.display = "flex";
} else {
backToTo.style.display = "none";
}
};
// section menu active
function onScroll(event) {
var sections = document.querySelectorAll('.page-scroll');
var scrollPos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
for (var i = 0; i < sections.length; i++) {
var currLink = sections[i];
var val = currLink.getAttribute('href');
var refElement = document.querySelector(val);
var scrollTopMinus = scrollPos + 73;
if (refElement.offsetTop <= scrollTopMinus && (refElement.offsetTop + refElement.offsetHeight > scrollTopMinus)) {
document.querySelector('.page-scroll').classList.remove('active');
currLink.classList.add('active');
} else {
currLink.classList.remove('active');
}
}
};
window.document.addEventListener('scroll', onScroll);
// for menu scroll
var pageLink = document.querySelectorAll('.page-scroll');
pageLink.forEach(elem => {
elem.addEventListener('click', e => {
e.preventDefault();
document.querySelector(elem.getAttribute('href')).scrollIntoView({
behavior: 'smooth',
offsetTop: 1 - 60,
});
});
});
"use strict";
}) ();
File diff suppressed because one or more lines are too long