滑动时禁用离子列表内离子滚动的垂直滚动

时间:2015-04-28 03:01:31

标签: cordova mobile ionic-framework ionic

将离子滚动包装到ion-list中时遇到了一些问题。

这是我的代码:

    <ion-content>

      <!-- The list directive is great, but be sure to also checkout the collection repeat directive when scrolling through large lists -->

      <ion-list show-delete="data.showDelete" show-reorder="data.showReorder">
 <ion-scroll style="height: 300px" >
        <ion-item ng-repeat="item in items" 
                  item="item"
                  href="#/item/{{item.id}}" class="item-remove-animate">
          Item {{ item.id }}
          <ion-delete-button class="ion-minus-circled" 
                             ng-click="onItemDelete(item)">
          </ion-delete-button>
          <ion-option-button class="button-assertive"
                             ng-click="edit(item)">
            Edit
          </ion-option-button>
          <ion-option-button class="button-calm"
                             ng-click="share(item)">
            Share
          </ion-option-button>
          <ion-reorder-button class="ion-navicon" on-reorder="moveItem(item, $fromIndex, $toIndex)"></ion-reorder-button>
        </ion-item>
</ions-scroll>
      </ion-list>

    </ion-content>

http://codepen.io/anon/pen/yNyjGx

我想要的是防止在离开物品时滚动,默认是有效的,但是当我试图包裹它时,它不起作用,你能帮助我一些替代方案吗?

我想用css调整离子列表的高度,所以我在离子列表中使用离子滚动

2 个答案:

答案 0 :(得分:4)

我不明白为什么你要这么简单的事情复杂化,去除离子滚动并给离子含量高度。你会得到你所需要的。

CodePen Here

<ion-content style='height : 300px'> 

答案 1 :(得分:2)

使用has-bouncing =&#34; false&#34;在离子含量

   <ion-content has-bouncing="false">

  <!-- The list directive is great, but be sure to also checkout the collection repeat directive when scrolling through large lists -->

  <ion-list show-delete="data.showDelete" show-reorder="data.showReorder">
      <ion-scroll style="height: 300px" >
    <ion-item ng-repeat="item in items" 
              item="item"
              href="#/item/{{item.id}}" class="item-remove-animate">
      Item {{ item.id }}
      <ion-delete-button class="ion-minus-circled" 
                         ng-click="onItemDelete(item)">
      </ion-delete-button>
      <ion-option-button class="button-assertive"
                         ng-click="edit(item)">
        Edit
      </ion-option-button>
      <ion-option-button class="button-calm"
                         ng-click="share(item)">
        Share
      </ion-option-button>
      <ion-reorder-button class="ion-navicon" on-reorder="moveItem(item, $fromIndex, $toIndex)"></ion-reorder-button>
    </ion-item>
   </ions-scroll>
  </ion-list>
 </ion-content>