| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- //行业菜单
- $('.hangye-has-arrow').click(function () {
- $(this).toggleClass('hangye-open');
- });
- $('.navbar-toggle').click(function () {
- var y = $(window).scrollTop();
- $('.navbar-toggle .icon-bar').toggleClass('hidden');
- $('.navbar-toggle .icon-close-bar').toggleClass('hidden');
- if (y == 0) {
- $('.site-header').toggleClass('new-face');
- }
- });
- //header tab的选中样式
- let pathName = window.location.pathname;
- $('#headerNav a').each(function (index, item) {
- if ($(item).attr('href') == pathName) {
- $(item).addClass('nav-active');
- }
- if ($(item).attr('href') == '/cases/' && /^(\/cases\/)/.test(pathName)) {
- $(item).addClass('nav-active');
- }
- });
- $('#header-solution a').each(function (index, item) {
- if ($(item).attr('href') == pathName) {
- $('#header-solution-title').addClass('nav-active');
- }
- });
- //案例部分LOGO切换
- $('#case-logo-div .case-logo-item').hover(function(){
- var index = $(this).index();
- $('#case-logo-dec .case-logo-dec-item').eq(index).show();
- },function(){
- $('#case-logo-dec .case-logo-dec-item').hide();
- });
- $('#case-logo-dec .case-logo-dec-item').hover(function(){
- var index = $(this).index();
- $('#case-logo-dec .case-logo-dec-item').hide();
- $('#case-logo-dec .case-logo-dec-item').eq(index).show();
- },function(){
- $('#case-logo-dec .case-logo-dec-item').hide();
- });
- //切换地址
- function onChangeAddress(){
- $('#address-tab li').on('click',function () {
- var index = $(this).index();
- $('#address-tab li').removeClass('active');
- $(this).addClass('active');
- $('#address-tab .address-info').hide();
- $('#address-tab .address-info').eq(index).show();
- if(index === 0) {
- $('#address-tab .shanghai-bg').stop().animate({opacity: '0'},100);
- $('#address-tab .beijing-bg').stop().animate({opacity: '1'},400);
- }
- if(index === 1){
- $('#address-tab .shanghai-bg').stop().animate({opacity: '1'},400);
- $('#address-tab .beijing-bg').stop().animate({opacity: '0'},100);
- }
- })
- }
- onChangeAddress();
- //移动端 tab切换
- function onChangeTab() {
- $('#tab-box .tab').on('click',function(){
- var index = $(this).index();
- $('#tab-box .tab').removeClass('active');
- $(this).addClass('active');
- $('#content-div .content').hide();
- $('#content-div .content').eq(index).show();
- })
- }
- onChangeTab();
- //案例切换 自动切换
- var activeIndex = 0;
- var interVal = null;
- function onChangeCases(index){
- activeIndex = index;
- $('#case-logo-nav .case-logo-item').removeClass('active');
- $('#case-logo-nav .case-logo-item').eq(index).addClass('active');
- $('#case-logo-content .case-logo-item').hide();
- $('#case-logo-content .case-logo-item').eq(index).show();
- }
- function setInter(){
- interVal = setInterval(function(){
- activeIndex++;
- if(activeIndex > $('#case-logo-nav .case-logo-item').length - 1){
- activeIndex = 0;
- }
- onChangeCases(activeIndex);
- },3000);
- }
- setInter();
- var timer = null;
- $('#case-logo-nav .case-logo-item').on('click',function(){
- var index = $(this).index();
- onChangeCases(index);
- clearInterval(interVal);
- if(!timer) {
- // clearTimeout(timer);
- timer = setTimeout(function () {
- setInter();
- }, 5000);
- }
- });
|