[v2] disable page scroll position restore

Can I disable the page scroll position when back to certain page? Because f7 didn’t handle if the page contains tabs with individual page-content for each tab

Pushed fix for this to repo

Many thanks for your effort, just thinking if the router.scrollHistory[] can be enhanced to include multi page-content position, then the scroll position of every tab in the same page can be restored. Your fix is great but only restore the active tab, anyway thumb up to you

Also in the doc, .tab is the same div as .page-content so the parents() coding may not work, is that right? Haven’t test it though

In theory it is possible, that will just require a lot more complex history object and potentially you may have tabs in tabs in tabs etc

You are right will fix it

1 Like

Yes it could be complicated, can we make use of the page-content sequence in DOM as identifier for storing the position? i.e assuming $$( ‘.page-current .page-content’).each() got the same sequence every time, which I am not too sure, so that we can save and restore position if they are in sequence, any idea?

Yes, that is the issue, we can’t rely, sequence is always the same. As you may have dynamic page content depending on data loaded each time

It’s quite challenging, let’s think about how to improve it, what about if you want to restore scroll position for tabs, then you must assign an identifier to DOM as data-tabpage for example, they f7 can based on that to remember the scrolling position, otherwise just leave it as default