今天除錯一個做好了的靜態網頁,用的是jQuery和原生js 在做動畫的時候用到了 IntersectionObserver 這個api 來監聽元素是否出現在視口 結果發現 相容性非常差:

相容性查詢網站 www.caniuse.com
但是找到了一個倉庫解決了該問題。

該倉庫由w3c提供 IntersectionObserver 相容指令碼
下載:
npm i intersection-observer -S
複製程式碼
使用:

(完)
今天除錯一個做好了的靜態網頁,用的是jQuery和原生js 在做動畫的時候用到了 IntersectionObserver 這個api 來監聽元素是否出現在視口 結果發現 相容性非常差:
相容性查詢網站 www.caniuse.com
但是找到了一個倉庫解決了該問題。
該倉庫由w3c提供 IntersectionObserver 相容指令碼
下載:
npm i intersection-observer -S
複製程式碼
使用:
(完)