Skip to main content

Navigate the Experience

Navigate the user through the experience using these SDK Methods.

setPage

Navigate to a specific page in the experience.

Parameters

ArgumentTypeRequiredDescription
pageIdstringYesThe id of the page to navigate to, e.g. page_12345.

Example

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

scrollTo

Scroll to a specific component on the experience.

Parameters

ArgumentTypeRequiredDescription
componentIdstringYesThe id of the component to scroll to, e.g. sign_up_436366175206.
settingsobjectNoKey value pair object containing settings to control the scroll action.
callbackfunctionNoCallback function that will be called once the scroll has been completed.
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
KeyTypeRequiredDefault ValueDescription
smoothstringNo"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.
offsetintegerNo0Offset number of px added to the scroll target.
durationinteger or functionNo800Duration of the scroll animation in milliseconds. Can also be a function (function(scrollDistinceInPx) { return durationInteger; }) to allow for more granular control at runtime.
delayintegerNo0Number of milliseconds to wait before starting the scroll animation.
isDynamicbooleanNofalseSet to true if the distance should be recalculated. Can be used if calculated scroll distance is incorrect (because of expanding/collapsing content).
horizontalbooleanNofalseSet 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');