leilukin-site/js/main-components.js

49 lines
1.8 KiB
JavaScript
Raw Normal View History

/* ------ MAIN HEADER COMPONENT ------ */
document.querySelector(".main-header").innerHTML = `
2023-06-27 14:57:47 +00:00
<img src="/assets/Leilukins-Hub-website-banner.png" alt="">
`;
2023-07-26 07:40:22 +00:00
/* ------ MAIN NAVIGATION BAR COMPONENT ------ */
document.querySelector(".navbar").innerHTML = `
2023-06-27 14:57:47 +00:00
<ul class="nav__menu">
2023-07-26 07:40:22 +00:00
<li><a href="/home.html">Home</a></li>
<li><a href="/about/">About</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="/articles/">Articles</a></li>
<li><a href="/mycreations/">My Creations</a></li>
<li><a href="/mymods/">My Mods</a></li>
<li><a href="/playlists/">Playlists</a></li>
<li><a href="/featured/">Featured</a></li>
<li><a href="/resources/">Resources</a></li>
<li><a href="/shrines/">Shrines</a></li>
<li><a href="/links/">Links</a></li>
<li><a href="https://leilukin.123guestbook.com/">Guestbook</a></li>
2023-06-27 14:57:47 +00:00
</ul>
2023-07-26 07:40:22 +00:00
`;
// Make the navigation bar sticky
const header = document.querySelector(".main-header");
const navbar = document.querySelector(".navbar");
2023-07-26 07:40:22 +00:00
window.addEventListener("scroll", e => {
const scrollPos = window.scrollY || document.documentElement.scrollTop;
const stickyLine = header.scrollHeight - navbar.scrollHeight;
if (scrollPos > stickyLine) {
navbar.classList.add("sticky-nav");
} else {
navbar.classList.remove("sticky-nav");
}
});
/* ------ MAIN FOOTER COMPONENT ------ */
document.querySelector(".main-footer").innerHTML = `
<p>Made with by Leilukin | <a href="/sitemap.html">Site Map</a></p>
<p>Site Launched: 11 September 2022 | <a href="/changelog">Website Changelog</a></p>
2023-08-29 14:14:04 +00:00
<p>
<a href="#page-top">
<i class="fa fa-arrow-up"></i> Back to top <i class="fa fa-arrow-up"></i>
</a>
</p>
`;