Play Audio On Click Using Elementor With A Button, Icon Or Image

Share on facebook
Facebook
Share on twitter
Twitter
Share on reddit
Reddit
Share on whatsapp
WhatsApp

Source Code

				
					<script type="rocketlazyloadscript">
let audioButton = document.querySelector('.audio-button');   // <-- Change CSS Class Here
       audioButton.addEventListener('click', function(){
        var audio = document.getElementById("audio");
        
         if (audio.paused) {
            audio.play();
        }else{
            audio.pause();
            // audio.currentTime = 0
        }
      });
    </script>
    
    <audio id="audio" src=""></audio>
				
			
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments

More to explorer

0
Would love your thoughts, please comment.x
()
x

45 Minute Wordpress Support

Get your Wordpress questions answered and your Wordpress issues resolved.