我正在使用Ionic及其SideMenu(标准模板)。
它工作正常,但是当我显示侧面菜单时,然后我向下滚动它(很长),然后我关闭它并尝试再次打开它保持向下滚动。
打开它时是否可以始终向上滚动? 我的菜单(base.html)模板:
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-more" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-energized">
<h1 class="title">Menu</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item menu-close href="#/app/overview" item-type="item-icon-left">
<i class="icon ion-information-circled"></i>
{{ 'overview' | translate }}
</ion-item>
<div class="item item-divider">
{{ 'logout' | translate }}
</div>
<ion-item ng-click="logout()" item-type="item-icon-left">
<i class="icon ion-power"></i>
{{ 'logout' | translate }}
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
答案 0 :(得分:1)
尝试使用$ ionicScrollDelegate.scrollTop();
HTML
<button class="button button-icon button-clear ion-navicon" menu-toggle="left" ng-click="toggleLeftSideMenu()"></button>
控制器
$scope.toggleLeftSideMenu = function () {
$ionicScrollDelegate.scrollTop();
};
答案 1 :(得分:0)
app.html:-
<ion-menu [content]="content" id="menu-up" (ionClose)="closingNavSlideUp()">Menu List
</ion-menu>
app.com.ts:-
import { Content } from 'ionic-angular';
export class projectName{
@ViewChild(Content) content: Content;
closingNavSlideUp() {
this.content.scrollToTop();
}
}
app.scss:-
ion-menu {
&#menu-up{
display: block !important;
visibility: hidden;
}
&.show-menu {
visibility: visible !important;
}
}