Answer the question
In order to leave comments, you need to log in
Reasonable use of an event handler?
Colleagues, I have a question.
If I need to hang a lot of code on, for example, scroll, what is the best way to do this?
Push everything into one handler, or break it into separate small blocks $('...').on('scroll',function(){...})
.
Or is there no difference?
Answer the question
In order to leave comments, you need to log in
If it is necessary that all code be executed, then it is better in one. And if it executes only part of the code, and ignores the other, then it is better to break it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question