var isscroll = { init: function(_el) { this.start(_el); $(window).on('scroll', function() { isscroll.start(_el) }); }, start: function(_el) { var self = this; $(_el).each(function() { var _self = $(this); var isscrolltop = $(window).scrolltop(); var iswindowheiget = $(window).height() * 0.85; var _class = $(this).data('animation'); if (isscrolltop + iswindowheiget > $(this).offset().top) { _self.addclass(_class); } }); } }