Last active
June 17, 2020 15:31
-
-
Save smallpaes/e08b80f1e320078632477b98db817662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let callback = (entries, observer) => { | |
entries.forEach(entry => { | |
if (entry.isIntersecting) { | |
// 目標元素進入 viewport 時做一些事情 | |
... | |
// 完成後,停止觀察當前目標 | |
observer.unobserve(entry.target) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment