This commit is contained in:
nelle 2024-07-22 19:41:59 -06:00
parent b1958f2672
commit 4b0c218ab9
7 changed files with 41 additions and 1 deletions

View file

@ -37,3 +37,31 @@ function OnInput() {
this.style.height = "auto"; this.style.height = "auto";
this.style.height = this.scrollHeight + "px"; this.style.height = this.scrollHeight + "px";
} }
// Sound effects
function PlaySound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.play();
}
function StopSound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.pause();
thissound.currentTime = 0;
}
const audio = new Audio("/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3");
const buttons = document.querySelectorAll("button");
const links = document.querySelectorAll("a");
links.forEach(a => {
a.addEventListener("click", () => {
audio.play();
})
})
buttons.forEach(button => {
button.addEventListener("click", () => {
audio.play();
});
});

View file

@ -3,8 +3,16 @@ import HeaderLink from "./HeaderLink.astro";
import { SITE_TITLE } from "../consts"; import { SITE_TITLE } from "../consts";
--- ---
<!--
onmouseover="PlaySound('hoverSound')"
onmouseout="StopSound('hoverSound')" -->
<nav class="menu content"> <nav class="menu content">
<button class="custom-btn btn-1" type="button" onclick="location.href='/'"> <button
class="custom-btn btn-1"
type="button"
onclick="location.href='/'"
>
<span>Home</span> <span>Home</span>
</button> </button>

View file

@ -15,5 +15,9 @@ import Footer from "../components/Footer.astro";
<Footer /> <Footer />
<script type="text/javascript" src="/scripts/limepot.js"></script> <script type="text/javascript" src="/scripts/limepot.js"></script>
<script type="text/javascript" src="/scripts/ntfy.js"></script> <script type="text/javascript" src="/scripts/ntfy.js"></script>
<audio
id="clickSound"
src="/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3"
></audio>
</body> </body>
</html> </html>