我有一个在x轴上滚动的离子内容,用户可以选择一个类别。选择后,它会隐藏该内容,但不幸的是,当我再次显示内容时,它无法滚动到预选的类别。
<ion-content direction="x" class="wide-as-needed animate-show" ng-show="showFilterStatus" style="float:left;width:100%;"
on-scroll="testSwipe()" scroll-event-interval="1000" has-bouncing="false" delegate-handle="small" padding="false" >
<ul class="hNav clearfix" style="width:800px;"> <!--style="width:500px;"-->
<!--<li ><a href="#"> </a></li>
<li ng-repeat="filter in filterList"><a ng-class="{sltItm: $index==showFilterSelected}" ng-click="changeFilter($index)">{{filter.filterType}}</a></li>-->
<li><img src="img/spacer.png" width="80" height="80" /></li>
<li ng-repeat="filter in fTest">
<img ng-src="{{filter.not_selected}}" width="80" height="80" ng-show="filSel != $index" ng-click="clickFilter($index)"/>
<img ng-src="{{filter.selected}}" width="80" height="80" ng-show="filSel == $index" ng-click="showFilter()"/>
</li>
<!--<li ><img src="img/spacer.png" width="80" height="80" /></li>-->
</ul>
</ion-content>
控制器
$scope.filSel = 0;
$scope.showFilter = function(){
//delegate.scrollTo(100*$scope.filSel, 0 , false);
if ($scope.showFilterStatus == false){
$scope.showFilterStatus = true;
delegate.scrollTo(100*$scope.filSel, 0 , false);
}
else{
$scope.showFilterStatus = false;
}
};
$scope.clickFilter = function($index){
if ($index == 4){
$scope.showFilterDetail();
}else{
$scope.filSel = $index;
startAtX = (100*$index);
delegate.scrollTo(100*$scope.filSel,0,true);
var time = $timeout(function() {
$scope.showFilterStatus = false;
return true;
}, 1000);
}
};
请帮忙