Checking if a tag is on the screen
if (box.left &gt; 0) {
    if (box.left &gt;= window.innerWidth) {
        return false;
    }
}



This seems a little redundant: the innerWidth is going to be greater than 0, so why do you need to conditionals?

Simply remove the outer one.



Your conditions are fairly short. Consider combining them:

if (box.right &lt;= 0 || box.bottom &lt;= 0) {
    return false;
}

if (box.left &gt;= window.innerWidth || box.top &gt;= window.innerHeight) {
    return false;
}




There isn't much more to say about your code, but I have an idea for future improvement: right now, your code will say true even if the element is partially hidden on the screen. How do you plan on handling this?