mirror of
https://github.com/vinta/awesome-python.git
synced 2026-03-23 13:56:43 +08:00
feat: redesign website homepage
This commit is contained in:
@@ -10,6 +10,37 @@ var rows = document.querySelectorAll('.table tbody tr.row');
|
||||
var tags = document.querySelectorAll('.tag');
|
||||
var tbody = document.querySelector('.table tbody');
|
||||
|
||||
function initRevealSections() {
|
||||
var sections = document.querySelectorAll('[data-reveal]');
|
||||
if (!sections.length) return;
|
||||
|
||||
if (!('IntersectionObserver' in window)) {
|
||||
sections.forEach(function (section) {
|
||||
section.classList.add('is-visible');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var observer = new IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (!entry.isIntersecting) return;
|
||||
entry.target.classList.add('is-visible');
|
||||
observer.unobserve(entry.target);
|
||||
});
|
||||
}, {
|
||||
threshold: 0.12,
|
||||
rootMargin: '0px 0px -8% 0px',
|
||||
});
|
||||
|
||||
sections.forEach(function (section, index) {
|
||||
section.classList.add('will-reveal');
|
||||
section.style.transitionDelay = Math.min(index * 70, 180) + 'ms';
|
||||
observer.observe(section);
|
||||
});
|
||||
}
|
||||
|
||||
initRevealSections();
|
||||
|
||||
// Relative time formatting
|
||||
function relativeTime(isoStr) {
|
||||
var date = new Date(isoStr);
|
||||
@@ -293,7 +324,7 @@ if (backToTop) {
|
||||
}
|
||||
});
|
||||
backToTop.addEventListener('click', function () {
|
||||
window.scrollTo({ top: 0 });
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user