Comments (5)
@oyeanuj Let me know if you end up using this package and need more help.
from react-scroll-parallax.
@jscottsmith Thanks for your help! it seems like I might not need this at the end of the day. I am going to try a couple of things and see how it goes.
from react-scroll-parallax.
@oyeanuj thanks for trying it out!
So, if I understand correctly, you want the first "FullViewport" image to be fixed to the window while the proceeding content would scrolls over top? If that is the case, I'm not sure this library is needed at all -- but maybe I don't completely understand.
Just in case, let me address some of your questions.
Assuming the setup is correct
From the structure you shared this looks setup correctly.
Without adding any offset props, nothing really happens. But I wasn't clear about what those props do. Could you clarify the purpose and the application of each of the prop? In other words, what do they affect?
Yup, without any props nothing will happen 😄 . I'll try to clarify what these props do: Given the following offset props offsetYMin={-100}
and offsetYMax={100}
, the component will translate along the y-axis
from -100px
to 100px
over the course of its visibility within the viewport. offsetXMin
and offsetXMax
will do the same except along the x-axis
. You probably already have, but please take a look at this example as it allows you to adjust these props and see how things are affected. Inspecting these <Parallax>
components using the React Developer Tools will also help you see how these props work.
If I move my
<Parallax />
to be the parent of<BackgroundImage />
rather than<FullViewport />
that breaks my image since it seems to break the height and width of the container. Is that to be expected?
If the height of the container is determined by the <FullViewport>
component then yes this is to be expected. I think you have it correct in the initial example. <Parallax>
components take on the height of their children just like normal <div>
s
Is the setup correct? Or would you achieve the same effect in a different manner?
I think I need an example/demo/design of what you are trying to achieve to be able to help any further. I'm happy to provide a demo of how to achieve an effect but I'll need some more clarification first.
from react-scroll-parallax.
@jscottsmith Thank you for the quick response, and the explanation. I can try and describe my experience and have whipped up a quick JSFiddle of my setup. Maybe I can try and create a gif or design to explain it as well but thought I'll give this a shot first.
My usecase is that I have an full width image (let's call it the ImageContainer) on the homepage that I am trying to have another full viewport container (let's call it the OverlayContainer) scroll on top of. I need this OverlayContainer to be slightly opaque so one can see the image beneath it.
Then once the overlay is on top of the image, I am looking for the page to scroll normally. On scroll up, I am hoping to visually undo the overlay scrolling off the image and have the image revealed.
Here is a JSFiddle that shows that layout visually - https://jsfiddle.net/3vbeah2h/3/
Hope that helps clarify it - if not, I'll try to share some design that would help. I was still at the first part of that experience trying to get the overlay to go over the background image.
To your original point, do you think this library is even needed at all?
from react-scroll-parallax.
Hmm, so based on that description I think you want to transition from a fixed position to a normally scrolling position. If that is the case you don't need this package. You'll need to track the scroll state with a listener and toggle a class from being fixed
to relative
on your image/div. This library won't help you with any of that unfortunately.
On the off chance I still misunderstand, are you looking for an effect like this example? It's the only other guess I could come up with based on the demo/description, but it is doable with this lib as you can see in the pen.
from react-scroll-parallax.
Related Issues (20)
- Issue trying to us horizontal axis on NextJS HOT 3
- Making parallax move to end and back HOT 2
- Can't get an <a> tag to be clickable inside a layer HOT 1
- with react-custom-scrollbars HOT 1
- It always run onEnter at the beginning. HOT 1
- Mac OS - Scrolling only updates once you stop scrolling HOT 2
- Add `disabled` prop to `ParallaxProvider` HOT 1
- Not working with CRA or Create Next App HOT 3
- Stop the effect at a given position HOT 7
- Scrolling beyond a `scrollStart` or `scrollEnd` value does not update the affected property to final value HOT 1
- Styles not defined in documentation HOT 1
- Next Js 13.5 Effects are not being rendered HOT 16
- Update props of parallax element HOT 2
- Cannot read properties of undefined (reading 'destroy') on live reload HOT 14
- Parallax effect not working in nextjs 13 HOT 6
- onLoad function does not fire on image layers HOT 1
- Could not find `react-scroll-parallax` context value. Please ensure the component is wrapped in a <ParallaxProvider> HOT 11
- Is it possible to animate custom properties? HOT 1
- Animation Position Issue with Sticky Container on Tab Change HOT 1
- Flickering when browser toolbar is shown/hidden HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-scroll-parallax.