Question:
I am using AOS to make on-load and on-scroll animations to further enhance my site, but on small screens such as small tablets and phones, certain parts of my website do not show up on the screen, but if I remove AOS from these certain parts of my website, they show up. Why is AOS not working and how can I fix it?
I don’t understand.
For one, I’ve only create 2 themes: one because I like the color blue and one because I was bored.
Secondly, this topic is not at all related to themes.
And finally, I was talking about AOS a library to make things animate on-scroll.
I think you will make it better looking online, I do know how to disable the AOS for small screens but I can’t get on the top of my head how to make the AOS Offset responsive (as it is more complicated).
Oh, by responsive I mean that the AOS will be responsive to small phones and tablets.
Tbh it would be something that I have to take a little time to study since I’m no longer programming in front-end.
I have the rough idea in my head but still is a bit complicated which would require some testing too.
This is a rough idea, I really don’t know if this will work:
document.addEventListener('DOMContentLoaded', function() {
// You get the current window width
var width = window.innerWidth;
//Than you define the AOS settings for different widths
if (width <= 600) { // For example, this can be for mobile devices
AOS.init({
offset: 200,
duration: 1000
});
} else if (width > 600 && width <= 900) { // And you make a condition for tablets too
AOS.init({
offset: 300,
duration: 1200
});
} else { // Else for just, you know, desktops
AOS.init();
}
});
It’'s a parameter that determines the position where the animation should start.
For example, if an element has an offset of 500, the animation will be triggered when the element is 500 pixels away from the bottom edge of the visible part of the screen.