$(function() { var store = { color: '', init: function() { this.even(); this.enterprise(); //业务板块 this.business(); }, business() { if($('.left_text3').length != 0){ $('.item_con').click(function() { $(this).next('.tc_con').show(); }); $('.he_guab').click(function() { $(this).parents('.tc_con').hide(); }); $('.left_text3').click(function(){ var num = $(this).parents('.swiper-slide').index(); $(this).parents('.bin_items').find('.right_item').eq(num).find('.tc_con').show(); }) $('.bin_sort:nth-child(1)').addclass('active'); $('.bin_items:nth-child(1)').addclass('show'); $('.bin_sort').click(function () { $(this).addclass('active').siblings().removeclass('active'); $('.bin_loop').find('.bin_items').eq($(this).index()).addclass('show').siblings().removeclass('show'); }); $('.bin_items:first-child').addclass('bin_items1') $('.bin_items:nth-child(2)').addclass('bin_items2') let binswiper1 = new swiper(".bin_items1 .left_swiper", { speed: 600, effect: 'fade', navigation: { nextel: ".bin_items1 .swiper_btn .swiper-button-next", prevel: ".bin_items1 .swiper_btn .swiper-button-prev", }, on: { init: function(swiper) { $(".bin_items1 .right_item").eq(0).addclass("active_li"); }, transitionstart: function() { var n = this.activeindex; $(".bin_items1 .right_item").eq(n).addclass("active_li").siblings().removeclass("active_li"); }, }, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeparents: true, //修改swiper的父元素时,自动初始化swiper }); let binswiper2 = new swiper(".bin_items2 .left_swiper", { speed: 600, effect: 'fade', navigation: { nextel: ".bin_items2 .swiper_btn .swiper-button-next", prevel: ".bin_items2 .swiper_btn .swiper-button-prev", }, on: { init: function(swiper) { $(".bin_items2 .right_item").eq(0).addclass("active_li"); }, transitionstart: function() { var n = this.activeindex; $(".bin_items2 .right_item").eq(n).addclass("active_li").siblings().removeclass("active_li"); }, }, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeparents: true, //修改swiper的父元素时,自动初始化swiper }); $(".bin_items1 .right_item").hover(function() { var n = $(this).index(); $(this).addclass("active_li").siblings().removeclass("active_li"); binswiper1.slideto(n,500); }) $(".bin_items2 .right_item").hover(function() { var n = $(this).index(); $(this).addclass("active_li").siblings().removeclass("active_li"); binswiper2.slideto(n,500); }) } }, enterprise() { let that = this; if ($('#c_static_001-1700563157203 .e_text-2 span').length != 0) { let name = $('#c_static_001-1700559109219 .e_text-8').text().trim(); if (name == '江苏国恒新材料科技有限公司') { $('#c_static_001-17006251468850').show(); $('#c_static_001-1700563157203').show(); $('#c_static_001-17006229306710').hide(); $('#c_static_001-17006324029560').hide(); } else if (name == '青岛国恩塑贸有限公司') { $('#c_static_001-17006324029560').hide(); $('#c_static_001-17006229306710').hide(); $('#c_static_001-1700623743845 .e_text-6').hide(); } else if (name == '浙江国恩物产有限公司') { $('#c_static_001-17006229306710 .e_text-2 span').text('办公环境') $('#c_static_001-17006229306710 .e_text-3').text('office environment') } } }, even() { let that = this; $('.nsapx img').attr('la','la'); $('.nsapx img').attr('alt','img'); $('.nsapx img').attr('title','img'); //首页-业务板块 $(".sort_item:first-child").addclass('active'); $('.loop_list:first-child').addclass('active'); $(".sort_item").mouseover(function() { $(this).addclass('active').siblings().removeclass('active'); $('.page1_list').find('.loop_list').eq($(this).index()).addclass('active') .siblings().removeclass('active'); }); //下属企业 let num1 = 1; let num2 = 1; $(".sort-con:first-child").addclass('active'); $(".sort-con").click(function() { $(this).addclass('active').siblings().removeclass('active'); }); $('.qiye_item').each(function() { $(this).attr('href', '#num' + num1) num1++; }) $('.xkncc').each(function() { $(this).attr('id', 'num' + num2) num2++; }); // 下属企业列表链接 $('li.xs1').each(function() { var url = $(this).find('a').attr('data-url'); var href = $(this).find('a').attr('data-href') if (url != href) { $(this).find('a').attr('target', '_blank') } }) $('.qiye_item').click(function(){ $('html,body').animate({ scrolltop: ($($(this).attr('href')).offset().top - 80) },1000); }); // 下属企业-详情 that.color = $('#c_static_001-1700559109219 .e_text-5').text().trim(); $('#c_static_001-1700559109219').css('background', that.color); $('#c_static_001-1700559109219 .e_image-2').css('background', 'rgba(226,231,236,1)'); $('#c_static_001-1700563157203 .e_text-11').css('border-color', that.color); $('#c_static_001-1700623743845 .e_container-8').css('background', that.color); $('#c_static_001-17006229306710 .e_text-11').css('border-color', that.color); $('#c_static_001-17006251468850 .e_text-11').css('border-color', that.color); $('#c_static_001-17006324029560 .e_text-11').css('border-color', that.color); $('#c_static_001-17006389722850 .e_text-11').css('border-color', that.color); // 底部-留言 $('#c_static_001-1700563431611 .e_image-11').click(function() { $('#c_static_001-1700563431611').removeclass('active'); }); $('#c_static_001-16420726718590 .e_text-41').click(function() { $('#c_static_001-1700563431611').addclass('active'); }) //导航 $('#c_static_001-16420726227420 .e_image-14').click(function() { $('#c_static_001-1700736895720').addclass('active') }); $('#c_static_001-1700736895720 .e_image-2,#c_static_001-1700736895720 .e_container-8').click(function() { $('#c_static_001-1700736895720').removeclass('active') }); $('.nav2_loop').each(function(){ var if_erji = $(this).find('a').length; if(if_erji == 0){ $(this).parents('.nav_item').find('.xiala').hide(); } }) $('.nav1 .xiala').click(function(){ $(this).toggleclass('active'); $(this).parent().next('.nav2').slidetoggle(); }); //搜索 $('#c_static_001-16420726227420 .e_image-13').click(function(){ $('#c_static_001-17008131074780').addclass('active') }); $('.hrhbg').click(function(){ $('#c_static_001-17008131074780').removeclass('active') }); // 科研创新手机端 $('#c_static_001-1705658485387 .e_loop-6 .p_loopitem:nth-child(1)').addclass('active'); $('#c_static_001-1705659383183 .e_loop-1 .p_list .cbox-1:nth-child(1)').addclass('active'); $('#c_static_001-1705658485387 .e_loop-6 .p_loopitem').click(function(){ $(this).addclass('active').siblings().removeclass('active'); $('#c_static_001-1705659383183 .e_loop-1 .p_list').find('.cbox-1').eq($(this).index()).addclass('active').siblings().removeclass('active'); }); // 国恩简介-页面跳转 $('.nav_item:nth-child(1) a').click(function(){ $('#c_static_001-1700736895720').removeclass('active'); }); $('#c_static_001-16420726227420 .e_navigationc-19 .p_navitem1:nth-child(1) a').click(function(){ $('#c_static_001-16420726227420 .e_navigationc-19 .p_navcontent').hide(); }); let width = window.innerwidth; if(width < 768){ $('#c_static_001-16420726227420 .e_navigationc-19 .p_navitem1:nth-child(1) .p_navitem2:nth-child(2) a').attr('href','/about.html#c_static_001-17008184295620'); $('#c_static_001-16420726227420 .e_navigationc-19 .p_navitem1:nth-child(1) .p_navitem2:nth-child(4) a').attr('href','/about.html#c_static_001-1705658485387'); $('#c_static_001-1700098471216 .e_categoryc-8 .p_c_item:nth-child(2) a').attr('href','/about.html#c_static_001-17008184295620'); $('#c_static_001-1700098471216 .e_categoryc-8 .p_c_item:nth-child(4) a').attr('href','/about.html#c_static_001-1705658485387'); } // 重置视频时间 $('.p_close').click(function(){ console.log('111') $('#c_static_001-1699950482723 .video').currenttime = 0; }); // 邮箱为空去掉 $('#c_static_001-1700623743845 .e_text-6').each(function(){ var text = $(this).text().trim(); if(text == '邮箱:'){ $(this).hide(); } }) }, } store.init(); })