$(function () { //轮播 if ($('#slider').length > 0) { $('#slider').nivoslider(); } var queue = []; var $body = $(document.body); function checkinsight() { queue.foreach(function (item) { var top = item.$el.offset().top; if ($body.scrolltop() + $body.height() > top && $body.scrolltop() < top + item.$el.height()) { item.callback(item.$el); } }) } $(window).on('scroll', function () { checkinsight(); }) function oninsight($el, fun) { queue.push({ $el: $el, callback: fun }) } oninsight($('.j_slide_in'), function ($el) { $el.find('.feedback-con').addclass('slide_in'); }) oninsight($('.j_slide_in2'), function ($el) { $el.find('.feedback-con').addclass('slide_in'); }) oninsight($('.zb-info'), function ($el) { $el.addclass('fade_in'); }) $.each($('.slide_init_r'), function (index, el) { oninsight($(el), function ($el) { $el.addclass('slide_in'); }) }) var numaniminit = false; oninsight($('.zb-count span'), function ($els) { if (!numaniminit) { numaniminit = true; $.each($els, function (index, el) { var numanim = new countup(el, 0, $(el).text()); numanim.start(); }) } }) settimeout(checkinsight, 500); })