A
A
Alexander2015-09-22 10:52:19
JavaScript
Alexander, 2015-09-22 10:52:19

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

1 answer(s)
S
Stalker_darkway, 2015-09-22
@AVEN1Q

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 question

Ask a Question

731 491 924 answers to any question