Jump to content
Search Community

Audio briefly plays when scrolling past section with ScrollSmoother

decemberly
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

decemberly
Posted

I have a series of sections stacked vertically, and some of them include audio. The audio is triggered using onEnter and onEnterBack events, and paused with onLeave and onLeaveBack, so that audio plays only while its associated section is in view. This setup works as expected during manual scrolling.

 

However, I also have a "Scroll to top" button that smoothly scrolls back to the top. The issue is: when I click this button, I still hear a brief snippet of audio—about half a second—even though I expect no sound to play during that transition.

 

Steps to reproduce:

  1. Click the "Allow audio" button.

  2. Manually scroll to the bottom — you'll hear audio playing in the middle section.

  3. Click the "Scroll to top" button — you’ll hear a short audio blip as the scroll passes through the audio section.

See the Pen oggvyeq by decemberly (@decemberly) on CodePen.

  • Solution
Rodrigo
Posted

Hi,

 

You can use some simple conditional logic to achieve this, something like this:

See the Pen qEEWwrO by GreenSock (@GreenSock) on CodePen.

 

Hopefully this helps

Happy Tweening!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...