Skip to main content

Use the scrollto function to navigate to widget

Updated over 4 years ago

Using a scrollTo function

scrollTo Overview: When a widget is placed far down the page, the Javascript scroll to helps place an anchor near the top. Upon click, the page scrolls down to the widget.


How it is used:

Scrollto is a simple JavaScript function that will, when clicked, scroll down to a predetermined place on the page. When a widget is placed far down the page, users have to scroll to find it and we risk lower interactions compared to a prominently placed widget. However, space on a page is always a premium. We recommend using the scrollto function and placing the call to action near the top and anchoring it to the div that calls the widget. In the screenshot, you can see the clickable link that initiates the scroll.

image2.jpg

On click, the page will scroll, not jump, to the anchored location. A scroll is a smooth move down the page so the user can watch other content go by instead of jumping to a location and skipping everything in between. The scroll preserves the natural movement of the page. Here is an example of how it looks.

image3.gif

Implementation:

Implementation is simple. A link or image that will be clickable is inserted as an HTML element and the scrollto function is called. In the function, you specify the location you want as the anchor. Use the div-id for the widget. Here is an example:

image1.png

That is all that needs to be done!

Did this answer your question?