【问题标题】:Vertical scroll not working over horizontal scroll list in ionic垂直滚动不适用于离子中的水平滚动列表
【发布时间】:2015-11-11 18:07:08
【问题描述】:

我有一个垂直滚动的窗口,在这个滚动中我有几个水平滚动的图像列表。

<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>

这里&lt;imgcard&gt; 指令归结为:

<div class="card">
    <div class="card-image">
        <img src="{{card.image}}"/>
    </div>
    <div class="card-description">
        {{card.desc}}
    </div>
</div>

现在的问题是,在移动设备上,如果我触摸图像列表之间的空间,我会尝试垂直滚动它可以正常工作。但是,如果我在垂直滚动时触摸图像列表,它就不起作用。

【问题讨论】:

    标签: scroll ionic-framework ionic


    【解决方案1】:

    我认为这是一个离子错误。 在离子束的第 8392 行,它设置了变量 isScrolling

    if ( typeof isScrolling == 'undefined') {
    isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );
    }
    

    但是当我调试我的应用程序时,delta.x==0 和 delta.y==0 大部分时间所以 isScrolling==false 也是。 只需在比较中添加一个 =。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-13
      • 2014-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多