I'm trying to detect whether an element is visible after the DOM is ready. This element is a third party widget that loads slower than the page does.
My console.log for 'dom ready' is firing - like it should, but my check to see if the element is visible is returning false, as the element loads after the dom is ready.
Is there a way to listen for elements after the dom has loaded?
<script>
$(function(){
console.log('dom ready');
if($(element).is(':visible')){
console.log('element is visible. do stuff.');
}
});
</script>