Added audio on lightmode

This commit is contained in:
Kristofers Solo 2023-01-20 06:07:04 +02:00
parent 4994e193b4
commit cf4c205c5e
4 changed files with 9 additions and 3 deletions

View File

@ -1,10 +1,11 @@
let lightmode = localStorage.getItem("lightmode") let lightmode = localStorage.getItem("lightmode")
const HTML = document.documentElement const HTML = document.documentElement
console.log(HTML)
const ENABLE_LIGHT_MODE = () => { const ENABLE_LIGHT_MODE = () => {
const AUDIO = document.getElementById("flashbang")
HTML.setAttribute("data-color-mode", "light") HTML.setAttribute("data-color-mode", "light")
localStorage.setItem("lightmode", "enabled") localStorage.setItem("lightmode", "enabled")
AUDIO.play()
} }
const DISABLE_LIGHT_MODE = () => { const DISABLE_LIGHT_MODE = () => {

View File

@ -48,6 +48,9 @@
<button id="color-mode-toggle" <button id="color-mode-toggle"
class="color-mode-toggle" class="color-mode-toggle"
aria-label="toggle dark mode "> aria-label="toggle dark mode ">
<audio id="flashbang"
src="{% static 'main/audio/csgo-throwing-flashbang-sound-effect.m4a' %}">
</audio>
<svg width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 496"> <svg width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 496">
<path fill="currentColor" d="M8,256C8,393,119,504,256,504S504,393,504,256,393,8,256,8,8,119,8,256ZM256,440V72a184,184,0,0,1,0,368Z" transform="translate(-8 -8)"/> <path fill="currentColor" d="M8,256C8,393,119,504,256,504S504,393,504,256,393,8,256,8,8,119,8,256ZM256,440V72a184,184,0,0,1,0,368Z" transform="translate(-8 -8)"/>
</svg> </svg>

View File

@ -14,8 +14,10 @@
{% block content %} {% block content %}
<div id="landing"> <div id="landing">
<div class="landing-title"> <div class="landing-title">
<video autoplay loop> <video autoplay
<source src="{% static 'main/img/hello-there.webm' %}" type="video/webm"> loop
src="{% static 'main/img/hello-there.webm' %}"
type="video/webm">
</video> </video>
<h1 class="text"> <h1 class="text">
I&#39;m <span id="swap-text">Kristofers Solo</span> I&#39;m <span id="swap-text">Kristofers Solo</span>