Streaming live at 10am (PST)

Scroll down 120px when tap on the Button

Hello I just need help with Interaction on Scroll down button.
I just need to be able to scrolldown on the page for 120px when user will click on button.

Hi @petrbilek :wave:

I can’t think of a way to scroll specifically 120px using interactions, but you could use this bit of custom code which is supr easy to add.
Here’s how to add custom code to a specific page in your page settings

Make sure you give your button or element an ID of myButton in the settings panel.

Paste this to the page in the Inside <head> tag section:

<style>
html {
  scroll-behavior: smooth;
}
</style>

and paste the code below into the Before <body> tag section

<script>
let button = document.getElementById("myButton");

button.addEventListener("click", () => {
  window.scrollBy(0, 120); // <-- you can change this amount if you need more than 120px
});
</script>

This should then work on any button with that same ID. If you only want it to work on one button, then just give it a different ID (you can still use the same class)

Hope this helps, please ping me if you have any trouble. :smile:

Please note that this will only work on the published site, and not in preview mode

Ahh, thank you I’ll try it!

1 Like

It works smooth :slight_smile: thanks!

1 Like

tenor%20(15)

1 Like

Hey @magicmark, this post has been exactly what I am looking for but i can only seem to get the first button on the page to work. Wondered if you might know what I’m doing wrong?

by the way, here is the project url for my example. I have used scroll method to be by width (window.innerWidth /1, 0) and on mouseover instead of ‘click’ But even with your example i can still only get the action to occur once?

https://ba-site-build.webflow.io/builds/dev-1-hover-slider