Skip to content

Commit

Permalink
ASas
Browse files Browse the repository at this point in the history
  • Loading branch information
imswarnil committed May 29, 2024
1 parent 928db00 commit 0ae085d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
62 changes: 40 additions & 22 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,47 @@ document.addEventListener('DOMContentLoaded', () => {
}


document.addEventListener("DOMContentLoaded", () => {
const blockquote = document.querySelector("blockquote");

const observer = new IntersectionObserver((entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
typewriterEffect(entry.target.querySelector("p"));
observer.unobserve(entry.target);
}
});
document.addEventListener("DOMContentLoaded", () => {
const blockquotes = document.querySelectorAll("blockquote");

const observer = new IntersectionObserver((entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
typewriterEffect(entry.target.querySelector("p"));
observer.unobserve(entry.target);
}
});

});

blockquotes.forEach((blockquote) => {
observer.observe(blockquote);
});

function typewriterEffect(element) {
const text = element.innerText;
element.innerHTML = "";
let i = 0;
const typing = setInterval(() => {
element.innerHTML += text[i];
i++;
if (i === text.length) clearInterval(typing);
}, 100); // Adjust typing speed as needed
});

function typewriterEffect(element) {
const text = element.innerText;
element.innerHTML = "";
let i = 0;
const typing = setInterval(() => {
element.innerHTML += text[i];
playTypingSound(); // Play typing sound effect
i++;
if (i === text.length) {
clearInterval(typing);
stopTypingSound(); // Stop typing sound effect when typing completes
}
}, 100); // Adjust typing speed as needed
}

function playTypingSound() {
const audio = new Audio("../../../keyboard.mp3"); // Path to the typing sound effect
audio.play();
}

function stopTypingSound() {
const audio = document.querySelector("audio");
if (audio) {
audio.pause();
audio.currentTime = 0;
}
}
Binary file modified click.mp3
Binary file not shown.
Binary file added keyboard.mp3
Binary file not shown.
1 change: 0 additions & 1 deletion pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ Quote: "The only limit to our realization of tomorrow will be our doubts of toda
> Somewhere, something incredible is waiting to be known

> Quote here OKLAY

0 comments on commit 0ae085d

Please sign in to comment.