function getStyle(ele, attr){//获取样式 return window.getComputedStyle ? window.getComputedStyle(ele, null)[attr] : ele.currentStyle[attr]; } function signClassChange(){//标签类选择器变更 let string = typeof(arguments[1]) == "undefined" ? "" : arguments[1]; for(let i = 0; i < arguments[0].length; i++){ arguments[0][i].className = string; } } function leftChange(arr, num){//偏移切换 for(let i = 0; i < arr.length; i++){ arr[i].style.left = num + "px"; } } function getActiveIndex(arr){//获取数组活动项下标 let i = 0; for(i; i < arr.length; i++){ if(arr[i].className == "active"){ return i; } } return 0; } function getBodyWH(){//获取页面宽高 return [ document.body.clientWidth, document.body.clientHeight ] } function replaceStr(str, tge){//将字符串中所有换行符替换为tga return str.replace(/\n/g, tge); } setTimeout(function(){//内页导航选定 let position_link = document.querySelectorAll(".position a"); let channel_lis = document.querySelectorAll(".channel ul li"); channel_lis.forEach(function(item, index){ item.index = index; if(item.querySelector("a").innerHTML == position_link[position_link.length - 1].innerHTML){ item.className = "active"; return; } }); }, 300); let citysitedrop = false; $('.header .dest span').click(function(){ citysitedrop = ! citysitedrop; if(citysitedrop){ $('.header .area').slideDown(); $('.header .dest img').css('transform', 'rotate(180deg)'); }else{ $('.header .area').slideUp(); $('.header .dest img').css('transform', 'rotate(0deg)'); } }); let aside = true; $('.aside .arrow').click(function(){ aside = ! aside; if(aside){ $('.aside').css('right','0'); $('.aside .open').css('opacity','0'); }else{ $('.aside').css('right','-128px'); $('.aside .open').css('opacity','1'); } }); $('.aside .open').click(function(){ aside = true; $('.aside').css('right','0').find('.open').css('opacity','0'); }); window.onscroll = function(){ let h = document.body.scrollTop != 0 ? document.body.scrollTop : document.documentElement.scrollTop; if(h >= 272){ $('.header .wrap').hide(); $('.header .nav-bar .bg-box2').hide(); $('.header').css({ 'position':'fixed', 'top':'0' }) }else{ $('.header .wrap').show(); $('.header .nav-bar .bg-box2').show(); $('.header').css('position','unset') } } //商桥 setTimeout(function(){ $('#nb_nodeboard').css('display', 'none'); $('#nb_icon_wrap').css('display', 'none'); }, 1500);