Jump to content

IanHost

Circle Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by IanHost

  1. Hey guys, this code I have found/put together from what i know, but when previewing in mobile, my hidden audio block doesn't autoplay. Can anyone help please? <script> window.addEventListener('DOMContentLoaded', function() { //wait for document load var audio = document.querySelector('.sqs-audio-embed'); //select the audio block var checkOnLoad = function() { if (window.pageYOffset > 200) { } else { audio.play(); } {audio.loop = true;} }; if (audio) { var url = audio.getAttribute('data-url'); //get the audio src Y.one(audio).ancestor('.sqs-block-audio').setStyle('display','none'); audio = new Audio(url); window.addEventListener('load', checkOnLoad); //listen for window load and toggle audio state checkOnLoad(); } }) </script>
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.