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

fix: clean up activeElements after resize #4

Merged
merged 1 commit into from Oct 25, 2021
Merged

fix: clean up activeElements after resize #4

merged 1 commit into from Oct 25, 2021

Conversation

IronKinoko
Copy link
Contributor

@IronKinoko IronKinoko commented Oct 24, 2021

trigger/src/trigger.js

Lines 44 to 54 in 3831e95

// Re-bind if resize occurs
window.addEventListener("resize", () => {
bind(ob, {
before: () => {
// Clean Up if necessary
activeElements.forEach((element) => {
ob.unobserve(element.el);
});
},
});
});

resize 事件里的 before hook 会不断的往 activeElements 添加重复元素,直到滚动事件发生

@stevenlei
Copy link
Contributor

确实应该要同时清理 activeElements,谢谢。

@stevenlei stevenlei merged commit a3a30bd into triggerjs:main Oct 25, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants