我有一个垂直滚动的窗口,在这个滚动中我有几个水平滚动的图像列表。
<ion-content class="container">
<ion-scroll direction="y" class="wide-as-needed">
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
<div>
<ion-scroll direction="x" class="wide-as-needed">
<imgcard ng-repeat="item in items" card="item"></imgcard>
</ion-scroll>
</div>
</ion-content>
在这里<imgcard>
指令归结为:
<div class="card">
<div class="card-image">
<img src="{{card.image}}"/>
</div>
<div class="card-description">
{{card.desc}}
</div>
</div>
现在的问题是,在移动设备上,如果我触摸图像列表之间的空间,我会尝试垂直滚动,但效果很好。但是,如果我在垂直滚动时触摸图像列表,它就不起作用。
最佳答案
我认为这是一个 ionic 错误。 在 ionic bundle 的第 8392 行设置了变量 isScrolling
if ( typeof isScrolling == 'undefined') {
isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );
}
但是当我调试我的应用程序时,delta.x==0 和 delta.y==0 大多数时候也是 isScrolling==false。 只需在比较中添加一个 =。
关于scroll - 垂直滚动不适用于 ionic 中的水平滚动列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32749774/