Comments (6)
Hi @jesperlandberg,
Did you tried running the demos folder? Parallax is not included in the basic builded file; you need to use an extended one.
Try editing the demo first to get an idea of how this works! Currently the elements are being removed from the DOM when it's not in viewport. You can comment the lines 96
and 105
of custom.js so you can debug it more easily.
There must be some ways of including parallax in the default build file, just need some more work. Please let me know what you think!
from smooth-scrolling.
Hi @jesperlandberg,
I don't think that you can use ScrollMagic with VirtualScroll as the plugin's gonna check for the scrollY position of the browser.
What you can do is add a class to the element when it enters the viewport (you can do that with smooth-scrolling only) and then remove the class when it's leaving again -- if you want animations to be run just once, don't remove the class when it leaves the viewport again.
Don't hesitate to ping whenever you have issues or questions!
from smooth-scrolling.
Hi, thanks for the answer (and sorry for this late bump:P ). Managed to get parallax working how I wanted.
Rather than starting a new issue thread (as this is not an issue, but not sure were to ask questions=) )... but do you know if it is possible to use scrollmagic (http://scrollmagic.io/) without using native: true?
from smooth-scrolling.
Thanks, will try it out=)
EDIT: In you example, what is the bare minimum I need to keep to check if in viewport? (trying to "reverse engineer" it myself but any help is appreciated:P
from smooth-scrolling.
Hey @jesperlandberg,
Sorry for the long delay... Not sure if I understand what you mean by 'bare minimum' ?
An element will be out of viewport if;
const inview = bottom > 0 && top < this.vars.height
- the
bottom
position is more than 0 - the
top
position of the element is less than the window height
If you want more threshold, you could do something like;
const threshold = 200
const inview = bottom > (threshold * -1) && top < (this.vars.height + threshold)
I also just added another demo with parallax effects. It's basically the default smooth-scrolling; a transform applied to a .vs-section container but with child elements that will also have transforms applied.
Lemme know :)
from smooth-scrolling.
Feel free to re-open if you have any other questions/issues with parallax scrolling!
from smooth-scrolling.
Related Issues (20)
- Horizontal scroll demos not working HOT 2
- (Parallax demo) vs-scrollbar-smooth and vs-scrollbar-parallax got different scroll position after smooth.scrollTo
- Build version including parallax HOT 4
- Empty space at page bottom when transitioning page HOT 2
- Has the latest version been published to NPM? HOT 2
- scrollTo() after resize HOT 2
- Cannot find module 'babelify'
- Next.js Compatibility HOT 2
- Immediately set the scroll position HOT 2
- How to implement with GSAP ScrollTrigger HOT 17
- Scroll event on container not working
- Hiding the scroll thumb when content doesn't extend beyond viewport. HOT 4
- Scrolling section responsive
- Uncaught TypeError: Class constructor Smooth cannot be invoked without 'new' HOT 1
- Error when building HOT 1
- StickySidebar with Smooth-Scroll
- Use native touch scrolling? HOT 6
- Smooth.resize() when using native gives error. HOT 1
- Custom easing function? HOT 1
- Horizontal scroll demo with both Y and X scrolling HOT 3
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 smooth-scrolling.