Distill 介绍
If you need many event handlers there are several ways to accomplish this:
1. you can use $(node).click etc or attachEvent
2. you can use inline onclick= method
The first option can be really slow if you have a huge collection of buttons
that need event handling, especially in IE, while the second option causes IE
to leak and run out of memory. This is why we created
JDistill, it’s a small library that uses bubbling
to attach event handlers to thousands of items in less than a millisecond.
distill is very easy to understand and use. It’s a ultra light weight event
dispatcher. To associate a node with an event, just put the object that
handles the event for the node in the class attribute and prefix it with com_.
<button class='com_eventhandler'>click me</button>
The example node above can be connected to an event like this:
myhandlers.eventhandler.click = function(){...}
And it integrates perfectly with jQuery:
$.distill("click",myhandlers);
Distill 官网
http://plugins.jquery.com/project/Distill
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。