Streaming live at 10am (PST)

Play sound upon scroll section


#1

Hi everyone, im trying to implement this code onto my website.

Basically, im trying to play a sound when a user scroll to a section on my page.

I have created an id #counter on my section but nothing happened when i scrolled to that section.

This is the script in my custom coding.

  var played = false;
  
  $(window).scroll(function() {
    var elemTop = $('#counter').offset().top, 
            elemHeight = $('#counter').outerHeight(), 
            windowHeight = $(window).height(),
            windowScroll = $(this).scrollTop();
    var countdownSound = new Audio(src="https://www.dropbox.com/s/8glll91m6eq716l/Click%20On-SoundBible.com-1697535117.mp3?dl=1");

    if( windowScroll > (elemTop + elemHeight - windowHeight) ) {
        countdownSound.play();
    }
});

May i get an assistance on this?

Thank you.


#2

Please try to format your code in your posts. Poorly formatted questions are difficult to understand.

To format code, select each code block and click the (Preformatted text) button.

Screenshot_2018-02-01_100238

I have edited your post for free this time.


#3

sorry, i do not get what you mean. Is there something wrong with the code?


#4

Thank you for helping to improve on my question, is there anything else that is unclear?

Please let me know.


#5

Welcome to the Webflow forum!

Could you please edit your post Screenshot_2017-08-16_140811 and provide ALL the necessary details in your post so we can take a look at your site/issue?

If you want faster replies and more accurate answers, it is recommended that you put in a bit more effort to include all the details listed in this link, so that forum members don’t have to waste time following up with you to request more information.

Hope to hear from you soon. Thanks!