<script async src="example.js"></script>
function come(elem) {
var docViewTop = $(window).scrollTop(),
docViewBottom = docViewTop + $(window).height(),
elemTop = $(elem).offset().top,
elemBottom = elemTop + $(elem).height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
if (come("#section2")) {
...
}
td{
display: block;
}
<td>
<div>
</div>
</td>