Jump to content

billylew

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by billylew

  1. Help! I've created a website for a wedding. I want music to play automatically as the page loads. I've tried to embed a Soundcloud link and Enabled Automatic Play from SoundCloud for the track to play automatically when the page loads. This does not work. So, I've embedded a code block on the page, and still the song won't play. I've used HTML and Javascript and tried different links, but the music will not play whatsoever. Please advise. Thank you in advance. Posted just now I'm having the same issue. My code block will not play. Please help me. <script> window.addEventListener('DOMContentLoaded', function() { //wait for document load var audio = document.querySelector('.sqs-audio-embed'); //select the audio block if (!Y.UA.mobile) { //it is not mobile var checkOnScroll = function() { if (window.pageYOffset > 200) { audio.pause(); } else { audio.play(); } }; if (audio) { var url = audio.getAttribute(' '); //get the audio src Y.one(audio).ancestor('.sqs-block-audio').setStyle('display','none'); audio = new Audio(url); window.addEventListener('scroll', checkOnScroll); //listen for window scroll and toggle audio state checkOnScroll(); } } }) </script>
  2. I'm having the same issue. My code block will not play. Please help me. <script> window.addEventListener('DOMContentLoaded', function() { //wait for document load var audio = document.querySelector('.sqs-audio-embed'); //select the audio block if (!Y.UA.mobile) { //it is not mobile var checkOnScroll = function() { if (window.pageYOffset > 200) { audio.pause(); } else { audio.play(); } }; if (audio) { var url = audio.getAttribute(' '); //get the audio src Y.one(audio).ancestor('.sqs-block-audio').setStyle('display','none'); audio = new Audio(url); window.addEventListener('scroll', checkOnScroll); //listen for window scroll and toggle audio state checkOnScroll(); } } }) </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.