$(document).ready(function(){ function pluscontnineCount() { var show = true; var countbox = ".pluscontnine"; $(window).on("scroll load resize", function(){ if(!show) return false; var w_top = $(window).scrollTop(); var e_top = $(countbox).offset().top; var w_height = $(window).height(); var d_height = $(document).height(); var e_height = $(countbox).outerHeight(); if(w_top + 200 >= e_top || w_height + w_top == d_height || e_height + e_top < w_height){ $(".pluscontnine-content-top-item__title").spincrement({ thousandSeparator: "", duration: 2000 }); show = false; } if(w_top + 200 >= e_top || w_height + w_top == d_height || e_height + e_top < w_height){ $(".pluscontnine-info-top-circle-procent").spincrement({ thousandSeparator: "", duration: 2000 }); show = false; } }); } pluscontnineCount(); });