Monaca Onsen UI Discord Chat Github Repo

how to keep page scroll position ?

  • when i use ons back button the shown page kept scroll position, but when i use javascript like this code

                document.querySelector('#myNavigator').pushPage('tempRegister', {
                    data: {
                        title: ''

    shown page scroll moved to the first, but i need to have prevoius position. is there any idea ? thank you

  • To get current scroll position:

    var scroll = document.querySelector('#page1 .page__content').scrollTop;

    To set it:

    document.querySelector('#page2 .page__content').scrollTop = scroll;


    document.querySelector('#myNavigator').pushPage('tempRegister', {data: '...'}).then(function(page) {
      page.querySelector('.page__content').scrollTop = scroll;