var aboutFn = { updatePlatform: function () { var isMobile = /android|iphone|ipad|ipod/g.test(window.navigator.userAgent.toLowerCase()) || $(window).width() <= 1024; var isMac = /mac os x/g.test(window.navigator.userAgent.toLowerCase()); if (isMobile) { $("body").addClass("mobile").removeClass("pc"); } else { $("body").addClass("pc").removeClass("mobile"); } }, // 动画 updateAnimate: function () { var selector = $(".show-in, .fade-in, .scale-in, .fade-in-up, .fade-in-left, .fade-in-right, .fade-in-down, *[count-up-to], *[count-up-to-p]"); var wh = $(window).height(); var st = $(window).scrollTop(); var offset = 0; var space = 150; selector.each(function () { var _this4 = this; var oft = $(this).offset().top - wh - st; var delay = parseInt($(this).attr("data-fade-delay"), 10) || 50; if (oft < 0 && !$(this).hasClass("show")) { $(this).attr("data-faded", true); if (oft > -wh) { offset += space; } setTimeout(function () { $(_this4).addClass("show"); window.animateShowCallback && animateShowCallback(_this4); if (!$('body[data-page="index"]').length) { $("*[count-up-to-p]").each(function () { $(this).html($(this).attr("count-up-to-p")); try { if ($(this).data("countup")) { $(this).data("countup").pauseResume(); } window.counterUp["default"](this, { duration: 1500, delay: 50 }); } catch (error) { console.log(error) } }); } }, 10); // }, $(this).attr("data-fade-immediately") === "true" ? delay : delay + offset); } }); }, setNavBg: function () { aboutFn.updatePlatform() aboutFn.updateAnimate() }, } $(function () { $(window).on("scroll", aboutFn.setNavBg); $(window).on("resize", aboutFn.setNavBg); aboutFn.setNavBg(); })