Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

改进Ajax刷新的处理 #14

Open
jerray opened this issue Mar 4, 2012 · 0 comments
Open

改进Ajax刷新的处理 #14

jerray opened this issue Mar 4, 2012 · 0 comments

Comments

@jerray
Copy link
Member

jerray commented Mar 4, 2012

现在的刷新机制是整个HTML代码块替换。替换后本来绑定了点击事件的元素丢失,所以又进行了重新绑定。
一个避免重复绑定的方案是利用JavaScript事件冒泡:
为需要监听的元素的父级元素(不会因刷新被替换的那个节点)绑定点击事件,当其中的元素被点击时捕获目标元素,判断如果是刷新按钮,则执行刷新流程。其余不做处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant