I am trying to add the attributes to launch AOS animations via javascript, but it is not working where I found the aos-init is not picking up in the div element and on scroll also aos-animation is not coming up. Now, adding direct is working fine. The code I have tire so far,
import AOS from 'aos';
window.addEventListener("DOMContentLoaded", () => {
AOS.init({
disable: false,
startEvent: 'DOMContentLoaded',
});
const test = document.querySelector(".test");
if(test){
test.setAttribute('data-aos', 'zoom-out-left');
}
});
Any way of initiating AOS through JS.Thanks in advance.