滚动固定内容中的列表

时间:2017-07-20 15:10:44

标签: html css angular ionic-framework ionic2

我希望在页面内容固定的情况下启用项目列表上的滚动。

这是我的代码:

<ion-content >
  <div style="width:94.5%; height:40%; margin:0 auto; margin-top:3%; margin-bottom:0%" #map="" id="map"></div>
    <ion-scroll scrollY="true">
      <ion-list class="list-style" no-border>
        <ion-item *ngFor="let location of locations">
          <ion-icon item-start name="star"></ion-icon>
          {{location.name}}
          <button ion-button icon-left outline item-end><ion-icon name="images"></ion-icon> Ver</button>
        </ion-item>
      </ion-list>
    </ion-scroll>
</ion-content>

该应用的图片:

enter image description here

我可以滚动项目列表,但我想修复其余的内容。我怎样才能做到这一点?

非常感谢

1 个答案:

答案 0 :(得分:0)

你可以添加位置:固定到地图/其他内容所在的div,并让剩下的内容滚动。

CSS:

.position-fixed {
    position: fixed;
}

HTML:

<div class="position-fixed">Map goes here</div>
<div>Scrolling content goes here</div>
相关问题