Here is my code:
var TestObserver = new IntersectionObserver(changes => {
changes.forEach(change => {
//some logic
})
}, { thresholds: 1 });
$(".Test").each(function () {
TestObserver.observe($(this));
});
After the code ran, Chrome reports this error:
Uncaught TypeError: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
What’s wrong with my code? And how can I solve this? Thank you.