const version = $('script[src*="yzb.js"]').attr('src').split('?version=')[1]; const oldvers = localStorage.getItem('version'); // 手动添加mate标签 function addMeta(item) { const meta = document.createElement('meta'); Object.assign(meta, item); document.getElementsByTagName('head')[0].appendChild(meta); } if (version != oldvers) { const metas = [ { httpEquiv: 'pragma', content: 'no-cache' }, { httpEquiv: 'Cache-Control', content: 'no-cache, no-store, must-revalidate' }, { httpEquiv: 'expires', content: '0' }, ]; metas.forEach(addMeta); localStorage.setItem('version', version); location.reload(true); } function addNumber(start, end, speed, timer, id) { let o = document.querySelector(id); let i = start; let Interval; if (i < end) { Interval = setInterval(function () { i += speed; // 设置每次增加的动态数字,可调整 if (i > end) { clearInterval(Interval); // 清除setInterval的time,这个方法w3c可具体查看文档 o.innerHTML = end.toLocaleString(); // 此赋值是为了避免最后一次增加过后的数据和真实数据不同 i = 0; } else { o.innerHTML = i.toLocaleString(); } }, timer); // 数据跳转的速度控制 } } function setAnimate(entry) { entry.forEach((x) => { const { target, isIntersecting } = x; const obj = $(target); if (obj.find('.animate__fadeInUp').length > 0 || !isIntersecting) return; if (obj.find('.mapNumc').length > 0) { obj.find('.mapNumc').addClass('animate__fadeInUp'); addNumber(0, 40, 1, 50, '.mapNumc'); addNumber(0, 100, 1, 25, '.mapNumy'); addNumber(0, 90000, 1000, 30, '.mapNumj'); } else { obj.find('.animate__animated').each((i, e) => { setTimeout(() => { $(e).addClass('animate__fadeInUp'); }, 100 * i); }); } }); } $(function () { $('a[href^="http"],a[href^="/"]').on('click', function (e) { //排除当前页面 if (e.target.origin + e.target.pathname == location.origin + location.pathname) { $('body').addClass('allScreen'); setTimeout(() => { $('body').removeClass('allScreen'); }, 400); return; } //排除顶部菜单集团官网id if (!['_blank', '_self'].includes($(this).attr('target')) && !e.ctrlKey && this.id != 'jpua35c6t') { $('.loader').addClass('show'); } }); //滑动显示元素 const obs = document.querySelectorAll('.observe'); if (obs.length > 0) { const observer = new IntersectionObserver(setAnimate, { threshold: [0.1, 1], rootMargin: '-125px 0px 0px 0px', }); obs.forEach((x) => { observer.observe(x); }); } }); window.addEventListener('pageshow', function(event) { $(function () { $('.loader').removeClass('show'); }) });