JesseZhao1990 / blog

learing summary
MIT License
62 stars 7 forks source link

IntersectionObserver #100

Open JesseZhao1990 opened 6 years ago

JesseZhao1990 commented 6 years ago

一种可以异步监听目标元素与其祖先或视窗(viewport)交叉状态的手段。祖先元素与视窗(viewport)被称为根(root)。

http://www.ruanyifeng.com/blog/2016/11/intersectionobserver_api.html https://w3c.github.io/IntersectionObserver/#intersection-observer-callback

由于这个规范兼容性还不理想,可以用下面这个polyfill https://github.com/w3c/IntersectionObserver/tree/master/polyfill