$(function(){ var scrollConfig = { enter: 'bottom', move: '60px', over: '0.9s', //reset: true, reset: false, init: true }; window.scrollReveal = new scrollReveal(scrollConfig); // $(window).scroll(function(event){ // let scrollTop = $(this).scrollTop(); // console.log(scrollTop); // if(scrollTop>125){ // //$('.section-header').addClass('fixed'); // }else{ // //$('.section-header').removeClass('fixed'); // } // }); // let scrollPosition = $(window).scrollTop(); // if(scrollPosition>125){ // //$('.section-header').addClass('fixed'); // } // var position = $(window).scrollTop(); // $(window).scroll(function() { // var scroll = $(window).scrollTop(); // if(scroll > position) { // console.log('scrollDown', '鍚戜笅婊氬姩'); // } else { // console.log('scrollUp', '鍚戜笂婊氬姩'); // } // position = scroll; // }); $('.section-banner video').on('click', function(){ var banner = $(this).closest('.section-banner'); var isPlay = banner.hasClass('playing'); if(isPlay){ $(this)[0].pause(); }else{ $(this)[0].play(); } banner[isPlay?'removeClass':'addClass']('playing'); }); //鐐瑰嚮瀵艰埅鑿滃崟婊氬姩瀵瑰簲閿氱偣 $('.section-header .navbar a, .section-footer .item1 .col-2 dt a, .section-banner .list-more').on('click', function(){ // let target = $(this).attr('to'); // let target_top = $('#'+target).offset().top; // target_top = target_top - 130; // $('html, body').animate({ // scrollTop: target_top // }); }); //鏄剧ず銆侀殣钘廻5瀵艰埅 $('.section-mobile-nav .item-header .menu-btn').on('click', function(){ let isActive = $('.section-mobile-nav').hasClass('active'); $('.section-mobile-nav')[isActive?'removeClass':'addClass']('active'); $('body')[isActive?'removeClass':'addClass']('active'); }); //鏄剧ず銆侀殣钘廻5浜岀骇瀵艰埅 $('.section-mobile-nav .main-nav .handle').on('click', function(){ let isActive = $(this).closest('.menu').hasClass('active'); $(this).closest('.menu').siblings().removeClass('active'); $(this).closest('.menu')[isActive?'removeClass':'addClass']('active'); }); //鏄剧ず銆侀殣钘廻5浜岀骇瀵艰埅 $('.section-mobile-nav .main-nav .sub-menu a').on('click', function(){ $('.section-mobile-nav').removeClass('active'); $('body').removeClass('active'); $(this).closest('.menu').removeClass('active'); // var href = $(this).prop('href'); // console.log(href); // var mao = location.hash; // if(mao){ // var target = $(mao); // if(target.length>0){ // $('.page').css({paddingTop: 60}); // } // } }); //pc绔 // $('.section-header .navbar .menu-drop .sub-menu').on('click', function(){ // var href = $(this).prop('href'); // console.log(href); // var mao = location.hash; // if(mao){ // var target = $(mao); // if(target.length>0){ // $('.page').css({paddingTop: 60}); // } // } // }); $('.page-index .section-product .arrow').on('click', function(){ let index = $(this).index(); $('.section-product .arrow').removeClass('active'); $(this).addClass('active'); $('.section-product .tabs .arrow').eq(index).addClass('active'); $('.section-product .list-more .arrow').eq(index).addClass('active'); $('.page-index .section-product .content-item').removeClass('active').eq(index).addClass('active'); let window_top = $(window).scrollTop(); $('html, body').animate({ scrollTop: window_top + 1 }); }); $('.section-banner .list-more').on('click', function(){ let bannerH = $('.section-banner').height(); $('html, body').animate({ scrollTop: bannerH + 10 }); }); $('.section-footer .item1 .col-2 dl').on('click', function(){ let isActive = $(this).hasClass('active'); $(this)[isActive?'removeClass':'addClass']('active'); }); // new Waypoint({ // element: document.getElementById('section-banner'), // handler: function(direction) { // if(direction=='down'){ // $('.section-header').addClass('fixed'); // }else{ // $('.section-header').removeClass('fixed'); // } // }, // offset: -110 // }); // new Waypoint({ // element: document.getElementById('section-banner'), // handler: function(direction) { // $('.section-header').removeClass('fixed'); // }, // offset: -800 // }); // new Waypoint({ // element: document.getElementById('section-banner'), // handler: function(direction) { // console.log(direction); // if(direction=='down'){ // $('.section-header').removeClass('fixed'); // }else{ // $('.section-header').addClass('fixed'); // } // }, // offset: -100% // }); $('body').on('mousemove', function(event){ //console.log(event.clientY); if(event.clientY<=10){ $('.section-header').addClass('fixed'); } }); if($('.page-index').length>0){ new Waypoint({ element: document.getElementById('section-banner'), handler: function(direction) { if(direction=='down'){ $('.section-header').addClass('fixed'); }else{ $('.section-header').removeClass('fixed'); } }, offset: '-10%' }); new Waypoint({ element: document.getElementById('section-banner'), handler: function(direction) { if(direction=='down'){ $('.section-header').removeClass('fixed'); }else{ } }, offset: '-100%' }); var position = $(window).scrollTop(); var bannerH = $('#section-banner').height(); $(window).scroll(function() { var scroll = $(window).scrollTop(); if(scroll > position) { //console.log('scrollDown', '鍚戜笅婊氬姩'); if( $('.section-header').hasClass('fixed') ){ if(position>bannerH+200){ $('.section-header').removeClass('fixed'); } } } else { //console.log('scrollUp', '鍚戜笂婊氬姩'); } position = scroll; }); new Waypoint({ element: document.getElementById('section-about-us'), handler: function(direction) { if(direction=='down'){ $(".jump").addClass('active'); } }, offset: '90%' }); new Waypoint({ element: document.getElementById('section-about-us'), handler: function(direction) { if(direction=='up'){ //$(".jump").removeClass('active'); } }, offset: '100%' }); //鍦嗗湀缂╂斁鏁堟灉 new Waypoint({ element: document.getElementById('circleScale'), handler: function(direction) { if(direction=='down'){ $("#circleScale").addClass('active'); } }, offset: 350 }); new Waypoint({ element: document.getElementById('circleScale'), handler: function(direction) { console.log(direction); if(direction=='up'){ //$("#circleScale").removeClass('active'); } }, offset: '100%' }); }else{ new Waypoint({ element: document.getElementById('section-banner'), handler: function(direction) { if(direction=='down'){ $('.section-header').removeClass('fixed'); }else{ $('.section-header').addClass('fixed'); } }, offset: '-88%' }); var position = $(window).scrollTop(); var bannerH = $('#section-banner').height(); //console.log(bannerH); $(window).scroll(function() { var scroll = $(window).scrollTop(); if(scroll > position) { //console.log('scrollDown', '鍚戜笅婊氬姩'); if( $('.section-header').hasClass('fixed') ){ if(position>bannerH+200){ $('.section-header').removeClass('fixed'); } } } else { } position = scroll; }); } // var a = true; // $('#section-about-us').waypoint({ // handler: function(direction) { // console.log(direction); // if(!a){ // return; // } // if(direction=='down'){ // console.log(1231313); // a = false; // $('.counter').countUp(); // } // }, // offset: 300, // }); new Waypoint({ element: $('.section-footer')[0], handler: function(direction) { if(direction=='down'){ console.log(direction); $('.page').css({paddingTop: 0}); } }, //offset: '100%' offset: 'bottom-in-view' }); isMao(); }); window.onload = function(){ //setTimeout(function(){ //$('.page').css({paddingTop: 0}); //isMao(); //}, 100); //isMao(); } window.onhashchange = function(){ //isMao(); } // function isMao(){ // console.log(location); // var mao = location.hash; // if(mao){ // mao = mao.replace('#', ''); // var h = 0; // if(mao=='mao'){ // h = $('.section-banner').height(); // console.log(h); // setTimeout(function(){ // window.scrollTo(0, h); // }, 200); // }else if(mao=='mao2'){ // if($('.page-product').length>0){ // h = $('.section-flow').offset().top; // } // setTimeout(function(){ // window.scrollTo(0, h); // }, 200); // } // } // } function isMao(){ var time = 200; //console.log(location); var mao = location.search; //console.log(mao); mao = mao.match(/mao=\d/); console.log(mao); if(mao){ mao = mao[0]; var h = 0; if($('.page-wisdom').length>0){ if(mao=='mao=1'){ h = $('.section-flow').offset().top; console.log(h); setTimeout(function(){ window.scrollTo(0, h-70); }, time); }else if(mao=='mao=2'){ h = $('.section-2').offset().top; console.log(h); setTimeout(function(){ window.scrollTo(0, h-20); }, time); } } if($('.page-product').length>0){ if(mao=='mao=1'){ h = $('.section-product').offset().top; console.log(h); setTimeout(function(){ window.scrollTo(0, h-160); }, time); }else if(mao=='mao=2'){ h = $('.section-flow').offset().top; console.log(h); setTimeout(function(){ window.scrollTo(0, h-60); }, time); } } if($('.page-news').length>0){ if(mao=='mao=1'){ h = $('.section-tabs').offset().top; console.log(h); setTimeout(function(){ window.scrollTo(0, h-70); }, time); } } } }