Skip to content

Commit

Permalink
add fade in method
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-luna-ray committed Feb 13, 2024
1 parent 9e40b82 commit 7b936bb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import {
import { projectCard, skillsCard } from '@/js/templates';
import '@/assets/styles/main.css';

function fadeInContent() {
const appElement = document.getElementById('app');
appElement.classList.remove('hidden');
appElement.classList.add('fade-in');

setTimeout(() => {
appElement.classList.add('visible');
}, 100);
}

document.addEventListener('DOMContentLoaded', async () => {
const data = await fetchHomePage();
const pageURL = window.location.href;
Expand All @@ -21,16 +31,8 @@ document.addEventListener('DOMContentLoaded', async () => {

// SEO
if (data) {
const appElement = document.getElementById('app');
appElement.classList.remove('hidden');
appElement.classList.add('fade-in');

// Add a delay before making the content visible
setTimeout(() => {
appElement.classList.add('visible');
}, 100);

addSEOTags(data.global.title, data.page.seoDescription, pageURL, getImageUrl(data.page.seoImage))
fadeInContent();
addSEOTags(data.global.title, data.page.seoDescription, pageURL, getImageUrl(data.page.seoImage));
}

if (data?.page?.aboutSection?.title) {
Expand Down

0 comments on commit 7b936bb

Please sign in to comment.