在ReactJS中,使用Reactstrap,我希望我的警报停留在它启动的屏幕上的相同位置

问题描述 投票:2回答:1

这是我的警报:

<MobileView>
  <UncontrolledAlert color="danger" fade={false}>
    <h4>
      This page is not optimized for mobile.
      <br/>
      Please view on a desktop device.
    </h4>
  </UncontrolledAlert>
</MobileView>

但是当用户滚动时,警报会移动。我希望它留下来。

这是关于alert的最佳文档,我可以找到https://github.com/reactstrap/reactstrap/blob/master/src/Alert.js

javascript reactjs reactstrap
1个回答
1
投票

我会做<Alert style={{position: 'fixed'}}/>

例如:https://jsfiddle.net/boe16gLr/

© www.soinside.com 2019 - 2024. All rights reserved.