# How do I scroll horizontally a specified pixel amount on click?

**URL:** <https://community.weweb.io/t/how-do-i-scroll-horizontally-a-specified-pixel-amount-on-click/7143>\
**Category:** How do I?\
**Created:** [February 20, 2024, 7:54pm UTC](https://community.weweb.io/t/how-do-i-scroll-horizontally-a-specified-pixel-amount-on-click/7143 "2024-02-20T19:54:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Micah](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/micah/32/9102_2.png) [@Micah](https://community.weweb.io/u/Micah)\
**Post date:** [February 20, 2024, 7:54pm UTC](https://community.weweb.io/t/how-do-i-scroll-horizontally-a-specified-pixel-amount-on-click/7143/1 "2024-02-20T19:54:17Z")

</div>

The only thing I can get to work is

`wwLib.getFrontDocument().getElementById('BigBoi').scrollIntoView({behavior: 'smooth', block: "start" });`

but what I need to happen is to scroll a specific pixel amount ex 400px. I have tried all the modifiers I can find and the normal js to scroll a px amount but still cannot get it to work.

Any ideas? Thanks!

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [February 22, 2024, 9:44am UTC](https://community.weweb.io/t/how-do-i-scroll-horizontally-a-specified-pixel-amount-on-click/7143/2 "2024-02-22T09:44:33Z")

</div>

Hi @Micah 👋

Have you tried doing it with no code?

Here’s a [video on how to setup infinite scrolling](https://youtu.be/f7lM-yqWJqY) that can help you with horizontal scrolling as well (it’ll be the same logic).

And here’s [another super short one](https://youtu.be/PqG1MlNQI7I) that explains how to scroll on the Y-axis (the same approach will work for the X-axis)

Does that help?

---

<div class="post-metadata">

**Author:** ![Micah](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/micah/32/9102_2.png) [@Micah](https://community.weweb.io/u/Micah)\
**Post date:** [February 22, 2024, 4:24pm UTC](https://community.weweb.io/t/how-do-i-scroll-horizontally-a-specified-pixel-amount-on-click/7143/3 "2024-02-22T16:24:56Z")

</div>

Hey Joyce, I don’t think those help with this specific case.

Here is a video

[![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/f2be7927f84d915a0ddac42c290d9196e3dccce3.jpeg "help with horizontal scrolling") ](https://www.youtube.com/watch?v=gawBT2oLStE)

Basically when I click the left or right buttons, it should scroll the container a fixed amount. I have put the watch scroll position on and can see its value changing when I scroll, I just can figure out how to target it to scroll a fixed amount.

Thanks for the reply!
