<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>GenshinFans | Genshin Impact Game Blog</title>
<meta content="GenshinFans is a professional Genshin Impact fan site, offering the latest guides, character builds, weapon recommendations, in-depth exploration, and version previews. Your one-stop platform for all Genshin Impact news and strategies!" name="description"/>
<meta content=",game guides,Genshin Impact guide,character builds,weapon builds,miHoYo,game news,GenshinFans,Genshin Impact tips,Genshin Impact walkthrough,game strategies" name="keywords"/>
<link href="https://www.genshinfans.cc/" rel="canonical"/>
<style>
/* Global Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
:root {
--primary: #5e94e6;
--secondary: #f9c22e;
--accent: #ff6e6e;
--dark: #2c3e50;
--light: #f5f5f5;
--anemo: #74c2a8;
--geo: #fab632;
--electro: #af8eb5;
--dendro: #a5c83b;
--hydro: #21e1eb;
--pyro: #f85f5f;
--cryo: #9fd6e3;
}
body {
background-color: var(--light);
color: var(--dark);
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7)),
url('/images/common/ffef88b063a9741a780991a12a6269f0.jpg');
background-attachment: fixed;
background-size: cover;
}
/* Header Section */
header {
background: linear-gradient(135deg, var(--anemo), var(--geo), var(--electro), var(--dendro), var(--hydro), var(--pyro), var(--cryo));
color: white;
padding: 1rem 0;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
}
header::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 40px;
opacity: 0.1;
z-index: 0;
}
.nav-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 2rem;
position: relative;
z-index: 1;
}
.logo {
display: flex;
align-items: center;
}
.logo img {
width: 50px;
height: 50px;
margin-right: 10px;
}
.logo h1 {
font-size: 1.8rem;
font-weight: 700;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
nav ul {
display: flex;
list-style: none;
}
nav ul li {
margin-left: 2rem;
}
nav ul li a {
color: white;
text-decoration: none;
font-weight: 500;
font-size: 1.1rem;
position: relative;
padding: 5px 0;
}
nav ul li a.active::after,
nav ul li a:hover::after {
width: 100%;
}
nav ul li a::after {
content: '';
position: absolute;
width: 0;
height: 2px;
bottom: 0;
left: 0;
background-color: white;
transition: width 0.3s ease;
}
/* Hero Section */
.hero {
height: 70vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
background-size: cover;
background-position: center;
color: white;
}
.hero::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7));
}
.hero-content {
text-align: center;
max-width: 800px;
padding: 0 2rem;
position: relative;
z-index: 1;
}
.hero h2 {
font-size: 3.5rem;
margin-bottom: 1rem;
font-weight: 800;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.hero p {
font-size: 1.3rem;
margin-bottom: 2rem;
line-height: 1.6;
}
.hero-buttons {
display: flex;
justify-content: center;
gap: 1rem;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 50px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
}
.btn-primary {
background-color: var(--anemo);
color: white;
box-shadow: 0 4px 10px rgba(116, 194, 168, 0.3);
}
.btn-secondary {
background-color: transparent;
color: white;
border: 2px solid white;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}
/* Main Content */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 3rem 2rem;
}
.section-title {
text-align: center;
margin-bottom: 3rem;
position: relative;
}
.section-title h2 {
font-size: 2.5rem;
color: var(--dark);
display: inline-block;
padding: 0 1rem;
position: relative;
z-index: 1;
}
.section-title::after {
content: '';
position: absolute;
width: 100%;
height: 2px;
top: 50%;
left: 0;
z-index: 0;
}
/* Featured Articles */
.featured-articles {
margin-bottom: 5rem;
}
.featured-grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 1.5rem;
}
.featured-main {
grid-column: span 8;
position: relative;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
height: 500px;
}
.featured-main img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.featured-main a:hover img {
transform: scale(1.05);
}
.featured-content {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 2rem;
background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
color: white;
}
.featured-content h3 {
font-size: 2rem;
margin-bottom: 1rem;
}
.featured-content p {
font-size: 1.1rem;
margin-bottom: 1rem;
opacity: 0.9;
}
.featured-content .meta {
display: flex;
align-items: center;
gap: 1rem;
font-size: 0.9rem;
opacity: 0.7;
}
.featured-content .tag {
background-color: var(--pyro);
color: white;
padding: 4px 10px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
}
.featured-side {
grid-column: span 4;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.side-article {
background-color: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
display: flex;
flex-direction: column;
height: calc(50% - 0.75rem);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.side-article:hover {
transform: translateY(-5px);
box-shadow: 0 12px 20px rgba(0, 0, 0, 0.12);
}
.side-article-image-link {
display: block;
height: 160px;
overflow: hidden;
}
.side-article img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.side-article a:hover img {
transform: scale(1.05);
}
.side-content {
padding: 1.2rem;
flex-grow: 1;
}
.side-content h3 {
font-size: 1.2rem;
margin-bottom: 0.7rem;
color: var(--dark);
}
.side-content p {
font-size: 0.9rem;
color: #666;
margin-bottom: 0.5rem;
line-height: 1.4;
}
.side-content .meta {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 0.8rem;
color: #888;
}
/* Recent Posts */
.recent-posts {
margin-bottom: 5rem;
}
.posts-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
}
.post-card {
background-color: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.post-card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 20px rgba(0, 0, 0, 0.12);
}
.post-card-image-link {
display: block;
width: 100%;
height: 200px;
overflow: hidden;
}
.post-card img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.post-card a:hover img {
transform: scale(1.05);
}
.post-content {
padding: 1.5rem;
}
.post-element {
display: inline-block;
padding: 3px 12px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
margin-bottom: 0.8rem;
color: white;
background-color: var(--primary);
}
.post-content h3 {
font-size: 1.4rem;
margin-bottom: 0.8rem;
color: var(--dark);
}
.post-content p {
font-size: 0.95rem;
color: #666;
line-height: 1.6;
margin-bottom: 1.2rem;
}
.post-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.85rem;
color: #888;
border-top: 1px solid #eee;
padding-top: 1rem;
}
.post-meta .author {
display: flex;
align-items: center;
}
.post-meta .author-name {
margin-left: 8px;
}
/* News & Updates */
.news-updates {
position: relative;
padding: 3rem;
background-color: white;
border-radius: 12px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
margin-bottom: 5rem;
}
.news-updates::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 10px;
background: linear-gradient(to right, var(--anemo), var(--geo), var(--electro), var(--dendro), var(--hydro), var(--pyro), var(--cryo));
border-radius: 12px 12px 0 0;
}
.news-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 2.5rem;
}
.news-main h3, .updates-sidebar h3 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
color: var(--dark);
border-bottom: 2px solid #f0f0f0;
padding-bottom: 1rem;
}
.news-list {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.news-item {
display: flex;
gap: 1.5rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid #f0f0f0;
}
.news-item:last-child {
border-bottom: none;
}
.news-item-image-link {
width: 120px;
height: 80px;
flex-shrink: 0;
overflow: hidden;
border-radius: 8px;
}
.news-item img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.news-item a:hover img {
transform: scale(1.05);
}
.news-item-content h4 {
font-size: 1.2rem;
margin-bottom: 0.5rem;
color: var(--dark);
}
.news-item-content p {
font-size: 0.9rem;
color: #666;
line-height: 1.5;
margin-bottom: 0.5rem;
}
.news-date {
font-size: 0.85rem;
color: #888;
}
.hot-articles-list .hot-article-item {
background-color: #f9f9f9;
padding: 1rem 1.5rem;
border-radius: 10px;
margin-bottom: 1.5rem;
border-left: 4px solid var(--primary);
transition: all 0.3s ease;
}
.hot-articles-list .hot-article-item:hover {
transform: translateX(5px);
box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}
.hot-articles-list .hot-article-item a {
text-decoration: none;
}
.hot-articles-list h4 {
font-size: 1.1rem;
margin-bottom: 0.5rem;
color: var(--dark);
}
.hot-articles-list p {
font-size: 0.85rem;
color: #666;
line-height: 1.4;
}
/* Popular Tags */
.popular-tags {
margin-bottom: 5rem;
}
.tags-container {
display: flex;
flex-wrap: wrap;
gap: 1rem;
justify-content: center;
background-color: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}
.tag-link {
background-color: var(--light);
color: var(--dark);
padding: 8px 16px;
border-radius: 20px;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
border: 1px solid #ddd;
}
.tag-link:hover {
background-color: var(--primary);
color: white;
border-color: var(--primary);
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* Newsletter */
.newsletter {
background-color: var(--dark);
color: white;
padding: 4rem 0;
text-align: center;
margin-bottom: 4rem;
position: relative;
overflow: hidden;
}
.newsletter::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 80px;
opacity: 0.05;
z-index: 0;
}
.newsletter-content {
position: relative;
max-width: 700px;
margin: 0 auto;
z-index: 1;
padding: 0 1rem;
}
.newsletter h2 {
font-size: 2.2rem;
margin-bottom: 1rem;
}
.newsletter p {
font-size: 1.1rem;
margin-bottom: 2rem;
opacity: 0.8;
}
.newsletter form {
display: flex;
gap: 1rem;
max-width: 500px;
margin: 0 auto;
}
.newsletter input {
flex-grow: 1;
padding: 0.8rem 1.5rem;
border: none;
border-radius: 50px;
font-size: 1rem;
background-color: rgba(255, 255, 255, 0.9);
}
.newsletter button {
padding: 0.8rem 1.8rem;
background-color: var(--secondary);
color: var(--dark);
border: none;
border-radius: 50px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.newsletter button:hover {
background-color: white;
transform: translateY(-3px);
}
.toast-notification {
position: fixed;
top: 20px;
right: 20px;
background-color: var(--anemo);
color: white;
padding: 15px 25px;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
z-index: 10000;
opacity: 0;
transform: translateY(-20px);
transition: opacity 0.5s ease, transform 0.5s ease;
}
.toast-notification.show {
opacity: 1;
transform: translateY(0);
}
/* Footer */
footer {
background-color: var(--dark);
color: white;
padding: 3rem 0 1rem;
}
.footer-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 2rem;
}
.footer-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
margin-bottom: 3rem;
}
.footer-col h4 {
font-size: 1.3rem;
margin-bottom: 1.5rem;
position: relative;
padding-bottom: 0.5rem;
}
.footer-col h4::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 40px;
height: 3px;
background-color: var(--secondary);
}
.footer-col ul {
list-style: none;
}
.footer-col ul li {
margin-bottom: 0.8rem;
color: #ddd;
font-size: 0.95rem;
}
.footer-bottom {
text-align: center;
padding-top: 2rem;
border-top: 1px solid #3a4a5d;
font-size: 0.9rem;
color: #bbb;
}
/* Responsive Styles */
@media (max-width: 1024px) {
.featured-grid {
grid-template-columns: 1fr;
}
.featured-main, .featured-side {
grid-column: 1 / -1;
}
.featured-main {
height: 400px;
}
.featured-side {
flex-direction: row;
}
.side-article {
width: 50%;
height: auto;
}
.news-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.nav-container {
flex-direction: column;
gap: 1rem;
}
nav ul {
flex-wrap: wrap;
justify-content: center;
}
nav ul li {
margin: 0.5rem;
}
.hero h2 {
font-size: 2.5rem;
}
.featured-side {
flex-direction: column;
}
.side-article {
width: 100%;
}
.footer-grid {
grid-template-columns: repeat(2, 1fr);
}
.newsletter form {
flex-direction: column;
}
}
@media (max-width: 576px) {
.posts-grid {
grid-template-columns: 1fr;
}
.hero h2 {
font-size: 2rem;
}
.hero p {
font-size: 1rem;
}
.btn {
padding: 10px 20px;
font-size: 0.9rem;
}
.footer-grid {
grid-template-columns: 1fr;
}
}
</style>
<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "GenshinFans",
"url": "https://www.genshinfans.cc",
"publisher": {
"@type": "Organization",
"@id": "https://www.genshinfans.cc/#website",
"name": "GenshinFans",
"url": "https://www.genshinfans.cc",
"description": "GenshinFans is a professional Genshin Impact fan site, offering the latest guides, character builds, weapon recommendations, in-depth exploration, and version previews. Your one-stop platform for all Genshin Impact news and strategies!",
"foundingDate": "2023",
"logo": {
"@type": "ImageObject",
"url": "https://www.genshinfans.cc/game_logo.png",
"caption": "GenshinFans Logo"
}
}
}</script></head>
<body>
<header>
<div class="nav-container">
<div class="logo">
<img alt="GenshinFans" src="/game_logo.png"/>
<h1>GenshinFans</h1>
</div>
<nav>
<ul id="nav-menu">
<!-- Navigation items will be loaded here by JavaScript -->
</ul>
</nav>
</div>
</header>
<section class="hero">
<div class="hero-content">
<h2>Adventure Awaits in Teyvat</h2>
<p>Explore the latest Genshin Impact strategies, character builds, lore theories, and community creations. Your ultimate guide to mastering the world of Teyvat.</p>
<div class="hero-buttons">
<a class="btn btn-secondary" href="#first-content-section" id="latest-content-btn">Latest Content</a>
</div>
</div>
</section>
<div class="container">
<section class="featured-articles" id="first-content-section">
<div class="section-title">
<h2>Featured Guides</h2>
</div>
<div class="featured-grid" id="featured-guides-container">
<!-- Featured Guides content will be loaded here by JavaScript -->
</div>
</section>
<section class="recent-posts">
<div class="section-title">
<h2>Popular Contents</h2>
</div>
<div class="posts-grid" id="popular-contents-grid">
<!-- Popular Contents will be loaded here by JavaScript -->
</div>
</section>
<section class="news-updates">
<div class="news-grid">
<div class="news-main" id="latest-news-container">
<h3>Latest News</h3>
<div class="news-list">
<!-- Latest News content will be loaded here by JavaScript -->
</div>
</div>
<div class="updates-sidebar" id="hot-articles-container">
<h3>Hot Articles</h3>
<div class="hot-articles-list">
<!-- Hot Articles content will be loaded here by JavaScript -->
</div>
</div>
</div>
</section>
<section class="popular-tags">
<div class="section-title">
<h2>Popular Tags</h2>
</div>
<div class="tags-container" id="popular-tags-container">
<!-- Popular Tags will be loaded here by JavaScript -->
</div>
</section>
<section class="newsletter">
<div class="newsletter-content">
<h2>Stay Updated on Teyvat's Latest</h2>
<p>Subscribe to our newsletter for guides, news, and exclusive content delivered directly to your inbox.</p>
<form id="newsletter-form">
<input placeholder="Your email address" required="" type="email"/>
<button type="submit">Subscribe</button>
</form>
</div>
</section>
</div>
<footer>
<div class="footer-container">
<div class="footer-grid" id="footer-grid-container">
<!-- Footer content will be loaded here by JavaScript -->
</div>
<div class="footer-bottom">
<p id="copyright-text"><!-- Copyright text will be loaded here by JavaScript --></p>
</div>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const fetchData = async () => {
try {
const response = await fetch('/data/index.json');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
// Populate all dynamic sections
populateNavigation(data.navigation);
populateFeaturedGuides(data.latest_guides);
populatePopularContents(data.latest_all);
populateLatestNews(data.latest_news);
populateHotArticles(data.latest_articles);
populateTags(data.tag);
populateFooter(data.footer, data.copyright);
highlightActiveNav();
setupEventListeners();
} catch (error) {
console.error("Failed to load page data:", error);
}
};
const populateNavigation = (navItems) => {
const navMenu = document.getElementById('nav-menu');
if (!navMenu) return;
navMenu.innerHTML = '';
navItems.forEach(item => {
const link = item.label.toLowerCase() === 'home' ? '/' : item.link;
navMenu.innerHTML += `<li><a href="${link}">${item.label}</a></li>`;
});
};
const populateFeaturedGuides = (guides) => {
const container = document.getElementById('featured-guides-container');
if (!container || !guides || guides.length === 0) return;
container.innerHTML = '';
let mainArticleHtml = '';
let sideArticlesHtml = '';
// Main article (first item)
if (guides[0]) {
const main = guides[0];
mainArticleHtml = `
<div class="featured-main">
<a href="${main.link}">
<img src="${main.image}" alt="${main.title}">
</a>
<div class="featured-content">
<span class="tag">${main.game}</span>
<h3>${main.title}</h3>
<p>${main.excerpt}</p>
<div class="meta">
<span>By ${main.author}</span>
<span>•</span>
<span>${main.date}</span>
</div>
</div>
</div>
`;
}
// Side articles (next two items)
if (guides.length > 1) {
const sideArticles = guides.slice(1, 3);
sideArticlesHtml = sideArticles.map(side => `
<div class="side-article">
<a href="${side.link}" class="side-article-image-link">
<img src="${side.image}" alt="${side.title}">
</a>
<div class="side-content">
<h3>${side.title}</h3>
<p>${side.excerpt}</p>
<div class="meta">
<span>By ${side.author}</span>
<span>${side.date}</span>
</div>
</div>
</div>
`).join('');
}
container.innerHTML = mainArticleHtml + `<div class="featured-side">${sideArticlesHtml}</div>`;
};
const createPostCard = (post) => {
return `
<div class="post-card">
<a href="${post.link}" class="post-card-image-link">
<img src="${post.image}" alt="${post.title}">
</a>
<div class="post-content">
<span class="post-element">${post.game}</span>
<h3>${post.title}</h3>
<p>${post.excerpt}</p>
<div class="post-meta">
<div class="author">
<span class="author-name">${post.author}</span>
</div>
<span>${post.date}</span>
</div>
</div>
</div>
`;
};
const populatePopularContents = (posts) => {
const grid = document.getElementById('popular-contents-grid');
if (!grid || !posts) return;
grid.innerHTML = posts.map(createPostCard).join('');
};
const populateLatestNews = (newsItems) => {
const list = document.querySelector('#latest-news-container .news-list');
if (!list || !newsItems) return;
list.innerHTML = newsItems.map(item => `
<div class="news-item">
<a href="${item.link}" class="news-item-image-link">
<img src="${item.image}" alt="${item.title}">
</a>
<div class="news-item-content">
<h4>${item.title}</h4>
<p>${item.excerpt}</p>
<span class="news-date">${item.date}</span>
</div>
</div>
`).join('');
};
const populateHotArticles = (articles) => {
const list = document.querySelector('#hot-articles-container .hot-articles-list');
if (!list || !articles) return;
list.innerHTML = articles.map(item => `
<div class="hot-article-item">
<a href="${item.link}">
<h4>${item.title}</h4>
<p>By ${item.author} - ${item.date}</p>
</a>
</div>
`).join('');
};
const populateTags = (tags) => {
const container = document.getElementById('popular-tags-container');
if (!container || !tags) return;
container.innerHTML = tags.map(tag => `<a href="${tag.link}" class="tag-link">${tag.name}</a>`).join('');
};
const populateFooter = (footerItems, copyright) => {
const grid = document.getElementById('footer-grid-container');
const copyrightEl = document.getElementById('copyright-text');
if (grid && footerItems) {
grid.innerHTML = footerItems.map(col => `
<div class="footer-col">
<h4>${col.title}</h4>
<ul>
${col.contents.map(item => `<li>${item}</li>`).join('')}
</ul>
</div>
`).join('');
}
if (copyrightEl && copyright) {
copyrightEl.textContent = copyright;
}
};
const highlightActiveNav = () => {
const navLinks = document.querySelectorAll('#nav-menu a');
const currentPath = window.location.pathname;
navLinks.forEach(link => {
const linkPath = new URL(link.href).pathname;
if (linkPath === currentPath) {
link.classList.add('active');
}
});
};
const showToast = (message) => {
const existingToast = document.querySelector('.toast-notification');
if (existingToast) {
existingToast.remove();
}
const toast = document.createElement('div');
toast.className = 'toast-notification';
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.classList.add('show');
}, 10);
setTimeout(() => {
toast.classList.remove('show');
setTimeout(() => {
toast.remove();
}, 500);
}, 3000);
};
const setupEventListeners = () => {
// Smooth scroll for "Latest Content" button
const latestContentBtn = document.getElementById('latest-content-btn');
if (latestContentBtn) {
latestContentBtn.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
}
// Newsletter form submission
const newsletterForm = document.getElementById('newsletter-form');
if (newsletterForm) {
newsletterForm.addEventListener('submit', function(e) {
e.preventDefault();
const emailInput = this.querySelector('input[type="email"]');
if (emailInput.value.trim() !== '') {
showToast('Subscribe successful!');
emailInput.value = '';
}
});
}
};
// Initial load
fetchData();
});
</script>
</body>
</html>