function onplayssoun(snd) { $('audio').stop(); //Останавливаем все аудио var audio = new Audio(); // Создаём новый элемент Audio audio.src = snd; // Указываем путь к звуку "клика" audio.autoplay = true; // Автоматически запускаем var audio = $('audio')[0]; $(document).click(function() { audio.play(); }); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter