2015-04-28 74 views
1

將離子滾動包裝到離子列表時,出現了一些問題。滑動時禁用離子滾動內部離子列表的垂直滾動

這是我的代碼:

<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的高度,所以我用內離子名單離子滾動

回答

4

我不明白你爲什麼要複雜化這麼簡單的事這麼多,去除離子滾動,給離子含量的高度。你會得到你所需要的。

CodePen Here

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

感謝,也許我應該碰到我的頭在牆上 –

+1

您還可以禁用離子滾動,而不是通過在離子內容標籤中添加'scroll =「false」來移除它:''。 – SPottuit

2

使用具有彈跳離子含量=「假」

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

如果你有側面菜單或有什麼有彈跳=「假」將做 – iDeekshith