jQuery delegate performance on the click event on large lists - slows down if you dynamically add more elements?

后端 未结 1 1459
借酒劲吻你
借酒劲吻你 2021-01-23 06:15

I have a visual list of items like this:

http://jsfiddle.net/viatropos/XCe3T/1/

In the real app, I\'m only loading 200 total items. But the problem is the

相关标签:
1条回答
  • 2021-01-23 07:09

    Based on my experience it is better (performance wise) to reinitialize (unbind and then bind event handlers again) than to use .live or .delegate. That way you should achieve the performance you need. Practically I would define a threshhold where delegate becomes slow, remove all the bindings and rebind the eventHandlers to the existing set of elements.

    0 讨论(0)
提交回复
热议问题