BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> openElement General Discussion
  New Posts New Posts RSS Feed - Sound, Click, How to?
  FAQ FAQ  Forum Search   Register Register  Login Login

Sound, Click, How to?

 Post Reply Post Reply
Author
Message
digizar View Drop Down
Senior Member
Senior Member
Avatar

Joined: Dec 30 2015
Location: Germany Frankfu
Status: Offline
Points: 738
Post Options Post Options   Thanks (0) Thanks(0)   Quote digizar Quote  Post ReplyReply Direct Link To This Post Topic: Sound, Click, How to?
    Posted: May 10 2017 at 10:05am
How would it be done to implement a 'click-sound' when a button ist pushed?
I have that website https://schreibmaschinenmuseum.org/
and I want to have that click with particular buttons, which sounds like a single old styled mechanical typewriter bounce.
I know it is in general not recommended to bother the user with such annoying kind of noise, but the customer wants it.
Any advice in the shelf? Would be great.

___________________________________
Ask questions only if there is no answer yet.
https://blumendigi.com
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (1) Thanks(1)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: May 10 2017 at 11:56am
Hi.

0) Put your sound into Files/Other as "sound.mp3"

1) Add a Custom Class play-sound  (in the corresponding Property) for each element that should play on click

2) Add a Code Block (Source) type Javascript with the code:


window.mySound = new Audio("/Files/Other/sound.mp3");
$(function(){
  $('.play-sound').mousedown(function(){ // you can replace mousedown by mouseup or click, depending on when you want the sound
     window.mySound.play();
  });
});

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.