$(document).ready(function() { var main = (function() { return { vars: { windowWidth: $(window).width(), mobile: ( $(window).width() < 992 ), }, init: function() { this.initFeatures(); }, initFeatures: function() { var that = this; that.initMonitor(); that.initVisao(); that.initConexao(); }, initMonitor: function() { var that = this, $window = $(window), detectPoint = $('#acer-monitor').offset().top;; $window.scroll(function() { if( $(window).scrollTop() > detectPoint - 100 ) { $('#acer-monitor .condicoes-image').addClass('active'); } }); }, initVisao: function() { var that = this, $window = $(window), detectPoint = $('#acer-visao').offset().top;; $window.scroll(function() { if( $(window).scrollTop() > detectPoint - 100 ) { $('#acer-visao .image-container').addClass('active'); } }); }, initConexao: function() { var that = this, $window = $(window), detectPoint = $('#acer-conexao').offset().top;; $window.scroll(function() { if( $(window).scrollTop() > detectPoint - 100 ) { $('#acer-conexao .image-container').addClass('active'); } }); } } })(); main.init(); });