user2412555
user2412555

Reputation: 1055

Ionic ion-content always autoscroll to top on page enter

I have an Ion-content with a long list in it, I can click on list item to goto another page, but on page back, it always auto scrolls to top, it is really annoying, can it be turned off?

page setup

<ion-view view-title="main view" class="vsmf-page">
    <ion-content delegate-handle="explore_scroller" on-scroll-complete="checkScroll()" autoscroll="false">
        <ion-refresher on-refresh="doRefresh()">
        </ion-refresher>
        <ion-list>
            <ion-item ng-repeat="page in pages" ng-click="gotoItemPage(page)">
                {{page.name}}
            </ion-item>
        </ion-list>
    </ion-content>
</ion-view>

PS, following route are structure used for me to auto setup routes through some autoloader wrote by myselfe, so it may differs from the ionic router structure, but I am sure it works.

the main page has a route like

'pageFrameView.explore',
                        {
                            url: "/explore",
                            views: {
                                'pageContent' :{
                                    template: "/template/page/explore/ExploreMainView.html",
                                    controller: 'ExploreMainView.controller'
                                },
                                'menuLeft': {
                                    template : "/template/page/menu/left/GeneralLeftMenu.html",
                                    controller: 'GeneralLeftMenu.controller'
                                },
                                'menuRight': {
                                    template : "/template/page/menu/right/ExploreRightMenu.html",
                                    controller: 'ExploreRightMenu.controller'
                                }
                            }
                        }

the item page has a route like

'pageFrameView.userProfile',
                        {
                            url: "/userProfile/:userid/:showapply/:showemail/:backto/:eventdate/:eventid/:requestid/:channelid/:showcancel/:showdetail",
                            views: {
                                'pageContent' : {
                                    template: "/template/page/explore/UserProfileView.html",
                                    controller: 'UserProfileView.controller'
                                }
                            }
                        }

Upvotes: 0

Views: 1728

Answers (1)

user2412555
user2412555

Reputation: 1055

Ok, here seems to be the real problem, the ion-header-bar has always tap to scroll to top event, and there is no way to stop the event propagation, so because the button are reside inside the ion-header-bar, each time i press the button, it seem also triggers a scroll to top event.

Wonder if this can be solved, but for now I have to turn the no-tap-scroll to true on the ion-header-bar.

Upvotes: 1

Related Questions