Vanilla JavaScript Plugin

Ifvisible.js  

Check page idle state and if the current browser tab is visible or not.

Plugin Website  Demo