I am trying to set a loader for the data loading section. but, I already have a loader for before loading full website data.
$(window).on("load", function () {
// Animate loader off screen
$(".se-pre-con").fadeOut("slow");
});`
And now I set this, to load the data section.
const npreloader = document.querySelector('.npreloader');
const fadeEffect = setInterval(() => {
// if we don't set opacity 1 in CSS, then
// it will be equal to "", that's why we
// check it
if (!npreloader.style.opacity) {
npreloader.style.opacity = 1;
}
if (npreloader.style.opacity > 0) {
npreloader.style.opacity -= 0.1;
} else {
clearInterval(fadeEffect);
}
}, 500);
window.addEventListener('load', ()=> fadeEffect);
Can I replace the event keyword "load" with any event? Because it overrides each other.