Skip to main content

Navigate the Experience

Navigate the Experience using these SDK Methods

setPage

Navigate to a specific page in the experience.

window.wyng['_WYNG_ID_'].setPage('page_12345');

scrollTo

Scroll to a specific component on the experience.

Parameters

KeyTypeDescription
componentIdstring - requiredThe id of the component to scroll to, e.g. sign_up_436366175206.
settingsobject - optionalKey value pair object containing settings to control the scroll action (optional argument. Default values will be used if not provided
callbackfunction - optionalCallback function that will be called once the scroll has been completed (optional)
tip

Instead of componentId this method will also work when passing it either a class or id value of an HTML element to scroll to. When using class, the first HTML element with the class that is found will be used to scroll to.

Settings

The following settings can be controlled using the settings argument

KeyTypeDefault ValueDescription
smoothstring"easeInOutQuart"Easing function used for scroll animation. Available animations: linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint. See easings.net for visual reference
offsetinteger0Offset number of px added to the scroll target
durationinteger or function800Duration of the scroll animation in milliseconds. Can also be a function (function(scrollDistinceInPx) { return durationInteger; }) to allow for more granular control at runtime
delayinteger0Number of milliseconds to wait before starting the scroll animation
isDynamicbooleanfalseSet to true if the distance should be recalculated. Can be used if calculated scroll distance is incorrect (because of expanding/collapsing content etc.)
horizontalbooleanfalseSet to true to invoke a horizontal scroll instead of vertical scroll.

Examples

Scroll to the component `sign_up_436366175206`
window.wyng['_WYNG_ID_'].scrollTo('sign_up_436366175206');