# Create Buttons for Horizontal Scrolling

Tutorial3 minPublished on Mar 20, 2023Updated on ![Webflow Tutorial](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/6711831a272fe97daa11e5b4_64760069e93084646c9ef158_62d28bd8755658adbcd0b5cd_Open-Graph-webflow-cursor.webp)Table of contents

[

Copied](#)[

](#)[

](#)[

](#)
- [H2 Example](#)

Use AI to summarize this article[

ChatGPT](#)[

Claude](#)[

Grok](#)[

Perplexity](#)[

Google AI](#)Key pointsIn today's tutorial, we will demonstrate how, using Webflow and a small piece of code, we can add buttons to our project that enable horizontal scrolling.

## Step 1: Overflow Auto

For this tutorial to work, it is essential that one of the elements on your page has an overflow set to auto, allowing for basic horizontal scrolling.

![overflow-auto](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/671268399030c930beb23f68_64760069e93084646c9eecc1_632330ac9d2622f22785c6cc_overflow-auto.webp)

## Step 2: Create 2 Buttons (or Link Blocks)

In your section, you will need to insert two buttons (or link blocks). The first will allow scrolling to the left, and the second will allow scrolling to the right.

You can customize them as you wish.

We recommend adding a custom attribute [aria-label](/blog/aria-label) to describe the buttons for the sake of web accessibility.

## Step 3: Add IDs to the Buttons

For your left button (which scrolls to the left), you can add the following ID: slideLeft

For your right button (which scrolls to the right), you can add the following ID: slideRight

![id button](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/671268399030c930beb23f65_64760069e93084646c9eecc0_632330c0d1c6ef75fd85e4cb_id-button-scroll-horizontal.webp)

## Step 4: Add an ID to Your Horizontally Scrollable Element

It is necessary to add an ID to the element that has overflow set to auto. You can give it any ID you desire.

![id section](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/671268399030c930beb23f60_64760069e93084646c9eecc2_632330d231601084313bb9bc_id-section-overflow-auto.webp)

## Step 5: Insert Code into Your Page

You will now go to your page settings. In the "Before body Tag" section, simply copy and paste the following code (make sure to replace ID-element-scrollable with the ID you defined in step 4):

`<script>
$('#slideRight').click(function() {
 $('#ID-element-scrollable').animate( { scrollLeft: '+=500' }, 1000);
});

$('#slideLeft').click(function() {
 $('#ID-element-scrollable').animate( { scrollLeft: '-=500' }, 1000);
});
</script>
`You can manage the "length" of the scroll by modifying the values of 500, and you can control the duration of the animation by changing the values of 1000.

![javascript code for horizontal scroll button](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/671268399030c930beb23f5c_64760069e93084646c9eecbf_632330e901f6bd841ae7b802_code-button-scroll-horizontal.webp)

If you wish, you can also hide the scrollbar by adding the following code (make sure to replace class-name-scrollable-element with the name of the class you assigned to your horizontally scrollable element):

`<style>
.nom-classe-element-scrollable::-webkit-scrollbar {
 height:0px;
}
</style>
`

## Step 6: Publish Your Project to See the Results

The JavaScript code only works when the site is live. Therefore, you will need to publish your project to use this feature.

![horizontal scrolling with buttons](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/671268399030c930beb23f6b_64760069e93084646c9eecc6_6323318fee0d9b11ca65d665_scroll-horizontal-bouton.webp)

And there you go, your new buttons now allow for horizontal scrolling (to the right or left) in your element.

Discover how to create a [progress bar in Webflow](/blog/how-to-create-scroll-progress-bar-webflow-tutorial)!

[

](#)![Thibaut Legrand](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/678a47ec4cabceb0d6aa7c2e_thibaut-website%20(1).webp)Thibaut LegrandCofounder at Vydera & Technical Solutions Architect[

](/team/thibaut-legrand)[

](https://www.linkedin.com/in/thibaut-legrand-digidop/)[

](https://twitter.com/lgd_thibaut)+1200 readers

## Stay ahead of the curve!
Subscribe now for expert insights.

[Subscribe

](https://digidop.substack.com/subscribe)![Preview Digidop Newsletter](https://cdn.prod.website-files.com/6705382c85d21c496de94fa5/671231c436687e9d40d995e9_newsletter-digidop.webp)[Preview Newsletter

](https://digidop.substack.com/)

## Suggested articles

![Collage of homepages from B2B SaaS agencies including Digidop, Vydera, FlowNinja, OFF+BRAND, Yuri & Neil, MetaLab, Shakuro and Ramotion](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/6ab922fa556f97c19ea7db9a_Best%20B2B%20SaaS%20Agencies%20in%202026_EN.webp)DocumentationAll blog post

### Top 20 Web & Digital Agencies for B2B SaaS in 2026

[Top 20 Web & Digital Agencies for B2B SaaS in 2026](/blog/best-b2b-saas-agencies)Top 20 Web & Digital Agencies for B2B SaaS in 2026![Webflow Source interface showing AI agents, website editing, and role-based Views in a unified workspace.](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/6a9fa9f8608ffcc774c47eb7_source%20(1).webp)NewsDevelopmentAll blog post

### Webflow launches Source. Our take on this shift.

[Webflow launches Source. Our take on this shift.](/blog/webflow-launches-source)Webflow launches Source. Our take on this shift.![Citation rate by AI platform: ChatGPT 100%, Perplexity 100%, Gemini 67%, and Claude 0%.](https://cdn.prod.website-files.com/67053868fc01e494462e71c9/6a9044c13914f1d6ac3e9161_citation.jpg)DocumentationAIAll blog post

### Make Your Website Visible in ChatGPT, Perplexity, and AI Answers

[Make Your Website Visible in ChatGPT, Perplexity, and AI Answers](/blog/make-your-website-visible-in-chatgpt-perplexity-and-ai-answers)Make Your Website Visible in ChatGPT, Perplexity, and AI Answers[See all articles

](/blog)Every great website  
starts with a conversation[Talk to an expert

](/contact)[Book a call

](/calendly)![Abstract composition of black and gold metallic ribbons with elegant light reflections and smooth gradients. A premium background conveying luxury, modernity, and innovation.](https://cdn.prod.website-files.com/6705382c85d21c496de94fa5/6a69a346549deffabdf98afa_shape-cta-footer.webp)