reactjs - 如何在主窗口上使用 react-spring 视差
问题描述
这是我第一次实现 react-parallax 效果,目标是在某些部分使用视差标签,但不是全部,但无论我尝试什么,视差标签似乎只是在这些部分创建一个单独的容器,我最终有两个滚动条。我只是想知道是否没有办法实现视差效果,只使用窗口滚动条作为唯一的滚动条。
import { Parallax, ParallaxLayer } from '@react-spring/parallax'
const Cards = () => {
return (
<>
<Titlebar title= 'Three major ethnic groups' />
<Parallax pages={3}>
<ParallaxLayer sticky={{ start: 1, end: 3 }} style={{ justifyContent: 'flex-start' }}>
<Test text='bole' paragraph='gimme that bole' source= {igbo} alter='igbo' />
</ParallaxLayer>
<ParallaxLayer offset={0} speed={0.5} style={{ justifyContent: 'flex-end' }}>
<p >Scroll down</p>
</ParallaxLayer>
<ParallaxLayer offset={1.5} speed={1.5} style={{ justifyContent: 'flex-end' }}>
<div>
<p>I'm not</p>
</div>
</ParallaxLayer>
</Parallax>
</>
)
}
export default Cards
这是我项目中的一些示例代码,再次解释一下。我希望能够使用仅使用窗口滚动条来滚动页面中的所有元素
解决方案
推荐阅读
- python - 使用 mkdir 创建目录并在 python 中循环时出错
- python - 使用 Python Flask 将文件上传到 IBM COS
- json - 无法在 Swift 中展开和折叠 TableViewCell
- angular - 根据angularJS v1.4.8中的值隐藏剑道网格列
- asp.net-core - 如何在 GraphQL .Net Core 中进行授权?
- javascript - 如何在 ChartJS 中插入标签而不重新缩放其他标签?
- python - 搜索和拆分列表
- amazon-web-services - 录制 wav 并将其上传到 Amazon S3
- python - 为 R 安装库并遇到“Rcpp”问题
- jenkins - jenkins 无法拉取分叉存储库上的提交