I have an intersection observer for one animation, but i want to use window.requestIdleCallback()
Where I should add the code window.requestIdleCallback(callback_1)?
my script:
if (document.querySelector('#weddings')) {
let observer_1;
let Element_1;
let prevRatio = 0.0;
let options = {
root: null,
rootMargin: "0px",
threshold: buildThresholdList()
};
// Set things up
Element_1 = document.querySelector("#img-1");
initObserver();
//////////////////////////////////////////////////////////////////////////////
function initObserver() {
observer_1