Created
September 21, 2020 15:53
-
-
Save roshanca/742442eb988abb156b5368dd24591d5d to your computer and use it in GitHub Desktop.
JS 如何检测元素是否被其他元素覆盖 #js
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
new IntersectionObserver( | |
([change]) => { | |
// 被覆盖就是 false,反之 true | |
console.log(change.isVisible) | |
}, | |
{ | |
threshold: [1.0], | |
delay: 1000, | |
trackVisibility: true | |
} | |
).observe(target) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment