Smooth scrolling allows you to easily jump between areas of your page without scrolling up and down, looking for specific sections manually.
Smooth scrolling works very well with anchor links, which allow you to quickly jump from any part of your page to another:
Here is a tutorial on how to set up your anchor links with smooth scrolling:
Locating your Element ID
The first step is to locate & copy the identifier (ID) of the section, element, or form you'd like the anchor link to scroll down to.
- In the builder, navigate to the element, section, or Unbounce form you want the anchor link to redirect your visitors to.
- In this example, the anchor link should scroll down to the form on the page. So, we will need to locate the element ID of the form.
- Single-click the element to bring up its properties within the Properties tab.
- Within the Properties tab on the right-hand side, scroll down to the Element Metadata section, and locate the ID of the element:
- Copy the ID value of this element. You'll need this later to create the Anchor Link.
Creating the Anchor Links
To add an anchor link to a button,
- Select the button within the builder.
- Navigate to the Properties tab on the right-hand side and scroll down to the Click Action section.
- Using the URL field, type the # symbol, then paste in the ID value:
To add an anchor link to a piece of text,
- Double-click the text block and select the text that you’d like to turn into a link.
- Or, highlight the specific text you want to add the anchor link to.
- Navigate to the Properties tab on the right-hand side, then select the Action tab.
- Using the URL field, type the # symbol, and paste in the ID value:
Click Save and be sure to Publish/Republish your page.
Now that you've set up your anchor link, you can add in the smooth scrolling feature to easily redirect your visitors to that page section.
Add 'Smooth Scrolling' to Anchor Links
Step 1: Install jQuery
Follow our documentation for steps on how to install jQuery onto your landing page.
Step 2: Install the 'Smooth Scrolling' script
- In the dialog box that appears, enter the following:
- Type Smooth Scrolling script as the Script Name.
- Select Before Body End Tag from the Placement menu.
- Paste the script below into the blank field:
- Click the Done button in the bottom right corner of the dialog box.
- As mentioned in the above note, remember to include the jQuery script in a new script box and the placement set to the Head. The smooth scrolling script will only work alongside jQuery.
- Be sure to Save and Publish/Republish your page.
You're all set!
To test out smooth scrolling on your page, open up the Preview mode, or view your published page. Custom scripts & CSS will only run in Preview mode or on a published page (and not in the builder).
Anchor link: A link on a page that brings you to a specific place on the same page.