Answer the question
In order to leave comments, you need to log in
How to disable the function on resize?
Can you please tell me how to disable the function at a small resolution, and execute the function ONCE at a large one? That is, if the resolution changed, the function would no longer run again
window.addEventListener("resize", function() {
if (window.innerWidth < 1024) {
console.log('mobile');
???
}
if (window. innerWidth >= 1024) {
console.log('note');
myFunction();
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question