$(function () { //var videos = $('.banner-swiper video'); if (window.innerwidth <= 750) { new wow().init(); } $(window).resize(function () { if (window.innerwidth / window.innerheight > 16 / 9) { $('body').addclass('width-longer').removeclass('height-longer'); } else { $('body').addclass('height-longer').removeclass('width-longer'); } if (window.innerwidth / window.innerheight > 4 / 3) { $('body').addclass('pad-width-longer').removeclass('pad-height-longer'); } else { $('body').addclass('pad-height-longer').removeclass('pad-width-longer'); } }).trigger('resize'); $('.banner .btn-fold').click(function () { $('.banner-left').toggleclass('folded'); }); settimeout(function () { $('.banner-left').addclass('folded'); }, 10000); $('.site-40th').click(function () { window.bannerswiper.slidetoloop(0); }); /*$('.sig-title .line').each(function (i, e) { $(e).splitletter(); anime.timeline({loop: false}) .add({ targets: e.childnodes, translatex: [40, 0], translatez: 0, opacity: [0, 1], easing: "easeoutexpo", duration: 1200, delay: (el, i2) => 1100 + i * 150 + 40 * i2 }); });*/ $('.scroll-hint').click(function () { $('html, body').animate({ scrolltop: window.innerheight - $('.site-header').innerheight() * .25 }, 500); }); window.businessswiper = new swiper('.business-swiper', { slidesperview: 1, effect: 'fade' }); $('.business-col').mouseenter(function () { var self = $(this); var index = self.index(); self.addclass('active').siblings().removeclass('active'); window.businessswiper && window.businessswiper.slideto(index); }); var counted = false; function checkupdatenumbers() { if ($('.intro .part2').hasclass('animated') && !counted) { counted = true; window.countup1 = new countup($('.part2-1 .value')[0], 0, 2466.84, 2, 5, { usegrouping: true, separator: ',', // 使用千分位时分割符号 decimal: '.', // 小数位分割符号 }); window.countup2 = new countup($('.part2-2 .value')[0], 0, 131.71, 2, 5, { usegrouping: true, separator: ',', // 使用千分位时分割符号 decimal: '.', // 小数位分割符号 }); window.countup3 = new countup($('.part2-3 .value')[0], 0, 60, 0, 5, { usegrouping: false, }); window.countup1.start(); window.countup2.start(); window.countup3.start(); } } /*function updateheadlineinfoheight(){ $('.headline .info').css('height', $('.headline').height() - $('.headline .cover').height() + 'px') } updateheadlineinfoheight();*/ if(window.innerwidth <= 960 && window.innerwidth > 750){ $('.headline .info').css('height', $('.headline').height() - $('.headline .cover').height() + 'px') } $('.site-footer').addclass('cascade'); var lastheight = 0; function updateplaceholderheight() { if (window.innerwidth <= 750) { return; } //获取所有没有已经滚动上去的区域 //已经滚动上去的区域的定义: //底部已经高于当前浏览器下边框 var totalplaceholderheight = 0; var status = 'settled'; $('.cascade').each(function (i, e) { //$(e).removeclass('settled revealing hidden'.replace(status, '')); var headerheight = $('.site-header').innerheight(); $(e).attr('data-class', status); if (status == 'settled') { $(e).addclass('animated'); $(e).find('.wow').addclass('animated'); $(e).css('transform', 'none'); } else { var eheight = $(e).innerheight(); $(e).css({ transform: 'translatey(' + -math.min(0, window.innerheight - eheight - headerheight) + 'px) translatez(0)' }); totalplaceholderheight += $(e).innerheight(); } //元素下边框 var elementtop = $(e).offset().top; var elementbottom = elementtop + $(e).innerheight(); //浏览器下边框 var explorertop = document.documentelement.scrolltop || document.body.scrolltop || window.pageyoffset; var explorerbottom = explorertop + window.innerheight; var nexte = $('.cascade').eq(i + 1); var nextebottom = math.min(0, window.innerheight - nexte.innerheight() - headerheight); if (status == 'revealing') { status = 'hidden'; } else if (status == 'settled') { if (nexte.length && (elementbottom + nexte.innerheight() + nextebottom) > explorerbottom + 1) { status = 'revealing'; } } }); if (totalplaceholderheight != lastheight) { $('.page-content').css('margin-bottom', totalplaceholderheight + 'px'); lastheight = totalplaceholderheight; } $('.cascade').each(function (i, e) { var newclass = $(e).attr('data-class'); $(e).removeclass('settled revealing hidden'.replace(newclass, '')); $(e).addclass(newclass); }); } $(window).scroll(checkupdatenumbers); $(window).scroll(updateplaceholderheight); updateplaceholderheight(); })