Visibility.js allow you to depend JS logic on page visibility state and save browser performance or create careful UI.
Andrey “A.I.” Sitnik
gem "visibility", "~> 0.1"