Comments (3)
Yes this is possible. Check my answer to: #66 #66
from lax.js.
yup, totally did not see that one, thank you :-)
from lax.js.
sweet, it worked!
I just made my own hook, ala useLax
, like so, directly in the component I'm parallaxing in:
function useLax() {
const requestRef = useRef();
useEffect(() => {
lax.setup() // initialization
const element = document.querySelector('#scroller') // Find your scrollable element
const updateLax = () => {
lax.update(element.scrollTop) // pass in the elements scrolled position
requestRef.current = window.requestAnimationFrame(updateLax);
};
requestRef.current = window.requestAnimationFrame(updateLax);
return () => {
if (requestRef.current) {
window.cancelAnimationFrame(requestRef.current);
}
};
}, []);
}
Thank you for this library! XD
from lax.js.
Related Issues (20)
- Can I add DOM from jQuery HOT 2
- Changing color on scroll HOT 1
- spinRev ? HOT 4
- Animate border-radius in % rather than pixels
- Having one element's scroll position control a different element's animation HOT 1
- Angular Example
- Support / Example for Svelte HOT 1
- VueJS 3 Example HOT 1
- Trigger video playback HOT 3
- How to perform animation only once and until end position reached? HOT 3
- Trouble centering an element on screen HOT 1
- How to use the options? I can find any info about it. HOT 1
- Support for backgroundPositionX and backgroundPositionY HOT 2
- Performance issues and crashes on iOS HOT 16
- Using with React? HOT 1
- Animation delay HOT 1
- Creating a toggle that turns Lax on and off
- Lax js not working when I set `height: 100%;` to html tag
- z-index not work on ios because of default translate3d(0.00001px, 0.00001px, 0.00001px); HOT 4
- Infinite loop encountered in the on-update example
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 lax.js.