forked from MarseyWorld/MarseyWorld
play the jumpscare audio with the img
parent
c6a7080776
commit
e6ccb2ec2c
|
@ -1,11 +1,11 @@
|
||||||
// Jump scare function
|
// Jump scare function
|
||||||
function scare() {
|
function scare() {
|
||||||
const image = document.getElementById("jumpscare-img");
|
|
||||||
image.style.display = "block";
|
|
||||||
|
|
||||||
const jumpscare_audio = document.getElementById('jumpscare-audio')
|
const jumpscare_audio = document.getElementById('jumpscare-audio')
|
||||||
jumpscare_audio.play();
|
jumpscare_audio.play();
|
||||||
|
|
||||||
|
const image = document.getElementById("jumpscare-img");
|
||||||
|
image.style.display = "block";
|
||||||
|
|
||||||
// Hide image and reset sound
|
// Hide image and reset sound
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
image.style.display = "none";
|
image.style.display = "none";
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
{% set image_src = SITE_FULL_IMAGES ~ "/assets/events/homoween/images/jumpscares/" ~ listdir("files/assets/events/homoween/images/jumpscares")|random ~ "?x=45" %}
|
{% set image_src = SITE_FULL_IMAGES ~ "/assets/events/homoween/images/jumpscares/" ~ listdir("files/assets/events/homoween/images/jumpscares")|random ~ "?x=45" %}
|
||||||
<img src="{{image_src}}" id="jumpscare-img" style="display: none">
|
<img src="{{image_src}}" id="jumpscare-img" style="display: none">
|
||||||
{% set audio_src = "/assets/events/homoween/audio/jumpscares/" ~ listdir("files/assets/events/homoween/audio/jumpscares")|random ~ "?x=45" %}
|
{% set audio_src = "/assets/events/homoween/audio/jumpscares/" ~ listdir("files/assets/events/homoween/audio/jumpscares")|random ~ "?x=45" %}
|
||||||
<audio id="jumpscare-audio" src="{{audio_src}}"></audio>
|
<audio id="jumpscare-audio" preload="auto" src="{{audio_src}}"></audio>
|
||||||
<script defer src="{{'events/homoween/js/jumpscare.js' | asset}}"></script>
|
<script defer src="{{'events/homoween/js/jumpscare.js' | asset}}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue