-
Notifications
You must be signed in to change notification settings - Fork 181
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
Different options for specific viewport sizes #70
Comments
Yes, you can use const animation = sal();
const switchAnimations = () => {
if (window.innerWidth < 768) {
animation.reset({
selector: 'animated-element',
once: true,
});
} else {
animation.reset({
// some other options
});
}
};
switchAnimations();
window.addEventListener('resize', switchAnimations); Remember that changing options on the fly can cause some flickering, as elements will receive new styles and animation will be repeated. |
Hi, thanks for getting back, Mirek. Ok, so this one works from your example (I am using default selector
When I modify your code to disable animations for mobile, it doesn't work. I still get the animations when I resize the browser and refresh.
|
@quantumleap33 try |
It doesn't work even with the correction. Only this code works for me: `const animation = sal(); const switchAnimations = () => { switchAnimations(); |
There is an example in the documentation regarding different options for specific viewport sizes.
I am not sure I understand the logic. I want to disable animations on mobile. Is there any way to do it?
The text was updated successfully, but these errors were encountered: