jQuery Listen

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-09 09:29:47

软件介绍

The release shown below is not the last. Please check 1.0.3 instead.

This plugin brings a clean, light solution, to websites with dynamic loaded content, or full of event bindings.
Intead of bound, handlers for events, are registered along with matching selectors.
And they'll still work for new added content.
This is achieved, using Event delegation, so the plugin will only work for events that bubble.

Update: jQuery.Listen can now handle both focus and blur events thanks to the focusin/focusout workaround.
Many thanks to Jörn Zaefferer for lending me the code!.

The plugin supports these kind of selectors:
- #id
- nodeName
- .class
- nodeName.class
- a comma-separated selector combining these 4.

I plan to add more support, but perfomance and scalability are my priorities. These simple selectors give enough functionality for many cases.

If, for example, you want tables, to react to clicks on it's rows, then you can do this:

jQuery('table').listen( 'click', 'tr', function(){
    alert('you clicked a row!!');
});


No matter how many times you add/remove rows, they will still be clickable.
You can also do this:

jQuery.listen( 'click', 'tr', function(){
    alert('you clicked a row!!');
});


This time, the listener will be the document. So now you can add/remove tables as well, clicking the rows will still trigger the handler.

If you need full support for selectors, and you mind sacrificing a little of scalability, you can check http://plugins.jquery.com/project/Intercept for a similar solution.

本文地址:https://codercto.com/soft/d/22986.html

世界因你不同

世界因你不同

李开复、范海涛 / 中信出版社 / 2010 / 29.8

这是李开复唯一的一本自传,字里行间,是岁月流逝中沉淀下来的宝贵的人生智慧和职场经验。捣蛋的“小皇帝”,11岁的“留学生”,奥巴马的大学同学,26岁的副教授,33岁的苹果副总裁,谷歌中国的创始人,他有着太多传奇的经历,为了他,两家最大的IT公司对簿公堂。而他的每一次人生选择,都是一次成功的自我超越。   透过这本自传,李开复真诚讲述了他鲜为人知的成长史、风雨兼程的成功史和烛照人生的心灵史,也首次全面......一起来看看 《世界因你不同》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具