-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from codingkatty/wonkysound
Wonky Sound
- Loading branch information
Showing
13 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const header = document.getElementById('chaos-header'); | ||
const words = header.textContent.split(' '); | ||
header.innerHTML = words.map(word => `<span>${word}</span>`).join(' '); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const sound = document.createElement('audio'); | ||
sound.style.display = 'none'; | ||
document.body.appendChild(sound); | ||
|
||
let arrayofnoises = ["sfx/bird.mp3", "sfx/buffalo.mp3", "sfx/cat1.mp3", "sfx/cat2.mp3", "sfx/elephant1.mp3", "sfx/elephant2.mp3", "sfx/penguin.mp3", "sfx/rooster.mp3", "sfx/tiger.mp3"]; | ||
|
||
function wonkySound() { | ||
let random = Math.floor(Math.random() * arrayofnoises.length); | ||
sound.src = arrayofnoises[random]; | ||
|
||
sound.currentTime = 0; | ||
sound.play(); | ||
} | ||
|
||
const links = document.querySelectorAll('a'); | ||
links.forEach(a => a.addEventListener('click', wonkySound)); | ||
|
||
const buttons = document.querySelectorAll('button'); | ||
buttons.forEach(button => button.addEventListener('click', wonkySound)); | ||
|
||
document.addEventListener('keyup', wonkySound); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[website I got audio from](https://pixabay.com/sound-effects/search/animals/?duration=0-30) |
Binary file not shown.