Novice web designer, need special help.
I have an html5 audio player that starts to play once a site visitor clicks the 'play' button. I would like for the click function to occur automatically if a site visitor remains idle on the website for more than 5 seconds. Any suggestions or direction on this would be very helpful.
$( document ).ready(function() {
$('.spinner-wrap').click(function() {
var $this = $(this),
audio = $this.siblings('audio')[0],
bpm = Number($this.siblings('audio').data('bpm'))
pulse = (60/bpm)*1000;
if (audio.paused === false) {
audio.pause();
audio.currentTime = 0;
$this.removeClass('playing');
clearInterval(intervals);
}
else {
audio.play();
$this.addClass('playing');
}
function pulsing() {
$this.addClass('pulse');
setTimeout(function() {
$this.removeClass('pulse');
}, pulse-100);
}
});
});