We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to configure the page not to scroll up when a modal is shown?

By default, all our modal Offer templates behave in such a way, that they force the website's page to scroll up when they are displayed. However, you are able to record the template's position and return back to it when the user closes the modal template.

For this, you need to add the below code snippet to the beforeBrowserEvent callback (this callback is executed before the offer is shown to the user):

tp.push(["addHandler", "beforeBrowserEvent", function (eventParams) {
       window.latestpositionY = window.scrollY;
}]);

After the user closes the offer, the checkoutClose callback is executed and you can just return the user to the previous position by firing this code:

tp.push(["addHandler", "checkoutClose", function(event){
      window.scrollTo(0, window.latestpositionY);}]);

You can find more information about Piano callbacks here.

Last updated: