Comments (2)
Hi,
both this workarounds fixed the issue:
import { NgZone } from '@angular/core';
constructor(private ngZone: NgZone) {}
ngAfterViewInit(): void {
if (isPlatformBrowser(this.platformId)) {
this.ngZone.runOutsideAngular(() => {
// Run code outside Angular zone
if (this.document.readyState == 'complete') {
console.log('doc loaded');
}
console.log('Page ready');
AOS.init({ once: true, duration: 1000 });
AOS.refresh();
});
}
}
or
constructor(@Inject(DOCUMENT) private document: Document) {}
ngAfterViewInit(): void {
if (isPlatformBrowser(this.platformId)) {
this.document.addEventListener('DOMContentLoaded', () => {
console.log('doc loaded');
console.log('Page ready');
AOS.init({ once: true, duration: 1000 });
AOS.refresh();
});
}
}
Another thing you need to change is:
import * as AOS from 'aos';
to
import AOS from 'aos';
Than you can use it like this in OnInit or AfterViewinit:
ngOnInit(): void {
if (isPlatformBrowser(this.platformId)) {
this.document.addEventListener('DOMContentLoaded', () => {
console.log('doc loaded');
console.log('Page ready');
AOS.init();
AOS.refresh();
});
}
}
from aos.
I had the same issue.I have a solution for you:
document.onreadystatechange = function () {
if (document.readyState == "complete") {
AOS.init();
}
};
I explain in depth in this video
from aos.
Related Issues (20)
- Getting a horizontal scrollbar due to AOS. When I set overflow-x: hidden, AOS stops working HOT 9
- Animation trigger too early when using other script like "load more" cards HOT 1
- not working correctly with Next.js 13.4.19 HOT 7
- mobile responsive
- Using aos in Astro HOT 3
- AOS does not work for fetch data
- How to do an "exit animation" manually using AOS?
- Aos is not working properly HOT 1
- Scrolling HOT 1
- Aos not working on Tailwind Css ..... HOT 3
- Parent element (body) isn't my main content element HOT 1
- AOS Animating each time a user visit to section HOT 2
- GH pages and AOS
- Animations are popping in and out on iPhone using Chrome browser HOT 1
- AOS on Solid Start
- `[Deprecation] Listener` added for a 'DOMNodeRemoved' mutation event HOT 2
- Can not show elements on mobile with disabled option
- AOS not working in IONIC + React project.
- aos not displaying content expected to to fade in HOT 1
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 aos.