Remove / add class on scroll

Any idea how to add it in on custom code?

Something like this?

<script>
$(window).scroll(function() {
  $('#myElementId').addClass('scrolled');
});
</script>
1 Like

Hi @samliew thank you for the answer.
Iv tried the code but its not working.

Iv added a fullpage.js to the site and its mostly ok. Im just trying to add a feature that will make the hero section “Without overflow” that will make the scroll bar invisible, until you scroll down to the next section right under it and then it becomes visible.

You cannot single out a section to selectively remove scrollbars.

I’m not sure if this would work for you (since I’ve never used fullpage.js before), but reading their documentation under State classes added by fullpage.js, it seems that they add an .active class on the active slide. So what you could potentially do in your CSS is make it so that, for example… #herosection.active { overflow: hidden; }.

You’ll have to play around with it a little bit based on what element you’re overflow hiding, but it could be something you can look into.

@garyyau @samliew

Iv added a cloneable fullpage.js on this post along with some of the other tricky features that are not working.