It's clear to me how to check if an element is visible on the page, by using the functions explained on this question.
//Where el is the DOM element you'd like to test for visibility
function isHidden(el) {
return (el.offsetParent === null)
}
Or
//Where el is the DOM element you'd like to test for visibility
function isHidden(el) {
var style = window.getComputedStyle(el);
return (style.display === 'none')
}
But to avoid pooling for the isHidden(el)
function, I'd like to be notified when a given element is made visible in the DOM (with pure JS, no jQuery or other frameworks).
In theory mutation observers could be used, but I need a solution for IE10+ browsers.
Any ideas?