-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pause and resume methods #58
Comments
I agree! Right now I destroy the rellax element on smaller viewports and it'd be great to have a vanilla way of recreating the rellax when the browser viewport sizes back up. I've tried a few things, but binding |
@c0mrx May I know why you destroy rellax on smaller viewports? |
@Glumanda99 The elements were moving too much and covering more important information, so for UX reasons I've disabled it on smaller screens. |
@c0mrx Thanks for your fast response! I'm not sure if I'm gonna have the same issues while designing, but I could imagine to remove the |
I think I also need to reset |
@Glumanda99 I ended up manipulating the speed attribute. It's not the cleanest way to do it, but it does work.
|
@c0mrx, in your code example above you are calling [1] - #91 |
@captainfromspace I believe it may be in one of the forks of this plugin. Either way, the function was added before line 284 of the plugin and is as follows:
|
I'm trying to use Rellax with the OnScreen. This is mainly required to achieve acceptable page performance. Therefore, I want to pause/suspend all rellax instances except for those that are visible in the viewport. Unfortunately, I couldn't achieve this without copying rellax src code and patching it. My recommendation is implementing two methods: attach() and detach(). All it should do is:
All this should be done WITHOUT reverting initial element styles. Otherwise it'll all jump-flicker. In my implementation it's as simple as: `Rellax.prototype.attach = function() { Rellax.prototype.detach = function() { |
Here's what I've used to make it run responsively:
(The throttle thing is not necessary, but you get the idea) |
Yeah, that looks good for your goals. In my situation, however, I need to reduce the use of animation frames. Otherwise it makes smooth scrolling jerky. So, I still need detach/attach. Preferrably, persisting Rellax instance. |
Maybe you could add
pause
andresume
methods. This could already do the trick:The text was updated successfully, but these errors were encountered: