_setting = { toggleimagesize: true, togglelazyload: true, imgurl: 'images/', menufixtriger: 250 } $(window).scroll(function () { scrollx = $(document).scrolltop(); basic.lazyload(); gobal.menufix(); }); $(window).resize(function () { ww = $(window).width(); }); var $index_i = 0; var $max = null; var $timer = null; $(document).ready(function () { if($('#zh-page').length>0){ $('.go-big').on('click',function () { $('.other').fadein(); }); $('.mask,.close').on('click',function () { $('.other').fadeout(); }); function scrolltolocation() { var maincontainer = $('.map-box'), half = maincontainer.height()/4, box = maincontainer.find('img').height(); maincontainer.animate({ scrolltop: box/2 - half }, 10);//2秒滑动到指定位置 } scrolltolocation(); } ww = $(window).width(); // alert(ww);1024:704 672 // alert($(window).height()); scrollx = $(document).scrolltop(); basic.table(); basic.animated(); _setting.togglelazyload ? basic.lazyload() : null; _setting.toggleimagesize ? basic.imgsize() : null; // basic.grids(); basic.devicerotate(); // nicescroll(); // mousewheel(); if (ww > 768) { gobal.menufix(); } gobal.sitemap(); gobal.terms(); gobal.bookmark(); gobal.active(); ww <= 1024 ? gobal.togglemenu() : null; ww <= 1024 && $('.content .left').size() > 0 ? gobal.touchswiper() : null; index.banner(); about.gongsigaikuang(); about.milestone(); about.response(); news.companynews(); news.medianews(); bussiness.main(); bussnet.interact(); join.talent(); $('#framework').click(function () { if ($(window).width() <= 768 && mobile()) { $_w = $(this).attr('data-width'); $_h = $(this).attr('data-height'); $('.bigview .con').css({ 'width': $_w, 'height': $_h }); $('.bigview').fadein(); } }); $('body').click(function () { $('.bigview').fadeout(); }); $('#framework').click(function (e) { e.stoppropagation(); }); // $('.newsdetial .detial p').removeattr('style'); if (ww > 768) { $('.we .detial .mandetial .con').nicescroll({ cursorcolor: "none", background: 'none', cursorwidth: '5', cursorborder: "none", cursorborderradius: "0", cursoropacitymin: '0.5', cursoropacitymax: '1', horizrailenabled: false, smoothscroll: false }); } $('.platfrom .block .tar a').click(function () { $(this).parent('.tar').parent('.row').toggleclass('active'); }); $pingtaislider = $('.jinqu .pingtai .slider').bxslider({ mode: 'fade', pager: false, controls: false, onsliderload: function () { $('.jinqu .pingtai .tabs li').click(function () { $eq = $(this).index(); $(this).addclass('active').siblings('li').removeclass('active'); $pingtaislider.gotoslide($eq); }); } }); $('.duocai .album').each(function (i) { $this = $(this); $slider = $this.find('.imgs .slider'); $preview = $(this).find('.imgs .preview'); $preview.attr('aid', i); (function (w) { $sliderf[w] = $slider.bxslider({ auto: false, pager: false, controls: false, auto: true, pause: 3e3, onslidebefore: function ($slideelement, oldindex, newindex) { $('.duocai .album:eq(' + w + ') .preview li').eq(newindex).addclass('active').siblings().removeclass('active'); } }); })(i); }); $('.duocai .album .preview li').click(function () { $fid = $(this).parent('.preview').attr('aid'); $eq = $(this).index(); $(this).addclass('active').siblings().removeclass('active'); $sliderf[$fid].gotoslide($eq); }); // 招聘详情 if (ww > 800) { _margin = 20; _itemwidth = ($('.detial .gaikuang .pics .items').width() - _margin * 2) / 3; $('.detial .gaikuang .pics .items').css({ width: $('.detial .gaikuang .pics .item').size() * (_itemwidth + _margin) }); $('.detial .gaikuang .pics .item').css({ width: _itemwidth, marginright: _margin }); } if (ww <= 800) { _html = ''; $('.detial .gaikuang .pics .items .item').each(function () { _html += '
  • '; }); $('.detial .gaikuang .pics .items').html(''); $('.detial .gaikuang .pics .items .slider').bxslider({ auto: true, pause: 3e3, pager: false, prevtext: '上一页', nexttext: '下一页' }); } }); var join = { talent: function () { $('.talent').find('.item').each(function (i) { i++; $(this).addclass('item' + i); }); facescale(); function facescale() { $('.talent .item .face').ratio({ scale: 1 }); if ($(window).width() > 480) { if ($('.talent').size() > 0) { _width = $('.talent .item .face').width(); _mgt = 0 - (_width / 2); $('.talent .item .face').css({ margintop: _mgt }); } } } $(window).resize(function () { facescale(); }); } } var relation = { csuite: function (data) { if (typeof (data) != 'undefined') { $items = $('
    '); $.each(data, function (key, data) { $item = $('
    '); $left = $('

    ' + data.jobname + '

    '); $right = $('
    '); $.each(data.member, function (k, member) { member.sex == '女' ? _class = "female" : _class = ''; $right.append($('
    ' + member.name + '

    ' + member.sex + ' ' + member.birth + '

    ')); }); $item.append($left).append($right); $items.append($item); }); $('.managers').append($items); } else { console.warn('出错了,relation.csuite()中的data数据未定义。'); } }, shareholder: function (data) { if (typeof (data) != 'undefined') { $items = $('
    '); $.each(data, function (k, holder) { $item = $('

    ' + holder.name + '

    持股数量:' + holder.amount + '
    持股比例:' + holder.percent + '
    股份性质:' + holder.prop + '
    '); $items.append($item); }); $('.shareholder').append($items); } else { console.warn('出错了,relation.shareholder()中的data数据未定义。'); } } } var bussnet = { interact: function () { $('.bussnet .filter .input select').on('change', function () { company = $('#company').val(); nation = $('#nation').val(); province = $('#province').val(); city = $('#city').val(); bussnet.getinfo(nation, province, city, company); }); }, getinfo: function (nation, province, city, company, is_default) { $.post('business.html?network', { "get_company": 1, "company": company, "nation": nation, "province": province, "city": city, "is_default": is_default }, function (result) { // alert(result); // alert(1); result = eval("(" + result + ")"); _html = '
    '; $.each(result, function (i, data) { _company = data.company; _city = data.city; _contact = data.contact.replace(/\n/g, "
    "); _html += '

    ' + _company + '

    城市: ' + _city + '

    ' + _contact + '

    '; // alert(i + ': ' + _company +','+_city + ',' + _contact +',' + _html); }); _html += '
    '; $('.bussnet .result').removeclass('fadeinright animated').addclass('fadeoutleft animated'); settimeout(function () { $('.bussnet .result').html(_html); $('.bussnet .result').removeclass('fadeoutleft animated').addclass('fadeinright animated'); basic.animated(); }, 400); }); } } var bussiness = { main: function () { // tabpage $('.tabpage .tab').on('click', 'li', function () { index = $(this).index(); $(this).addclass('active').siblings().removeclass('active'); $('.tabpage .pages').find('.page').eq(index).addclass('active').siblings().removeclass('active'); }); // ajax $('.products .filter .items').on('mouseenter', 'li', function () { $(this).addclass('active').siblings().removeclass('active'); type = $(this).attr('type'); bussiness.getinfo(type); }); $('.products .filter .items').on('click', 'li', function () { $(this).addclass('active').siblings().removeclass('active'); type = $(this).attr('type'); bussiness.getinfo(type); }); // sidebar barscroll = 0; current = 0; typesize = $('.products .filter .items li').size(); typeheight = $('.products .filter .items li').outerheight(); if ($(window).width() > 480) { $('.products .filter .arrows').on('click', '.btn', function () { activeli = $('.products .filter .items .active').index(); if ($(this).hasclass('next')) { if (current > 0) { current--; barscroll -= typeheight; $('.products .filter .items').animate({ scrolltop: barscroll }, 500); } } else { if (current < typesize - 3) { current++; barscroll += typeheight; $('.products .filter .items').animate({ scrolltop: barscroll }, 500); } } if (activeli < current) { activeli += 1; $('.products .filter .items li').eq(activeli).click(); } if (activeli > current + 2) { activeli -= 1; $('.products .filter .items li').eq(activeli).click(); } }); } else { $maxscroll = (math.ceil(typesize / 3) - 1) * typeheight; $('.products .filter .arrows').on('click', '.btn', function () { if ($(this).hasclass('prev')) { if (barscroll < $maxscroll) { barscroll += typeheight; } } else { if (barscroll >= 0) { barscroll -= typeheight; } } $('.products .filter .items').animate({ scrolltop: barscroll }, 500); }); $('.products .filter').swipe({ swipe: function (event, direction, distance, duration, fingercount, fingerdata) { if (direction == 'up' || direction == 'left') { if (barscroll < $maxscroll) { barscroll += typeheight; } } else { if (barscroll > 0) { barscroll -= typeheight; } } $('.products .filter .items').animate({ scrolltop: barscroll }, 500); } }); } }, getinfo: function (pid) { // $('.products .filter .items>li').each(function () { // if ($(this).attr('type') == pid) { // $(this).addclass('active').siblings().removeclass('active'); // } // }); $.post("business.html", { "pid": pid }, function (result) { data = eval('(' + result + ')'); // 产品 _description = ''; // 核心能力 _capacity = ''; // 行业地位 _position = ''; // 运营单位 _entity = ''; // 优势服务 _service = ''; // 经营单位 _operator = '
    '; // $operator = data.operator; // wwwreg = /www\.\w*\.\w*/g; // $.each($operator, function (i, info) { // _operator += '
    '; // _operator += '

    ' + info.company + '

    '; // //_operator+='

    '+info.contact.replace(/\n/g,'
    ').replace(wwwreg,''+regexp.$1+'')+'

    '; // _operator += '

    ' + info.contact.replace(/\n/g, '
    ') + '

    '; // _operator += '
    '; // }); $operator = data.industry_scope.operating_scope; wwwreg = /www\.\w*\.\w*/g; _operator += '
    '; //_operator+='

    '+info.contact.replace(/\n/g,'
    ').replace(wwwreg,''+regexp.$1+'')+'

    '; _operator += '

    ' + $operator.replace(/\n/g, '
    ') + '

    '; _operator += '
    '; _operator += '
    '; // 代理品牌 $agency = data.agency; if ($agency.length <= 0) { $('.products .tabpage .tab li').eq(2).hide(); $('.products .tabpage .tab li').eq(0).click(); } else { $('.products .tabpage .tab li').eq(2).show(); } $parentarray = [1, 3, 6, 7, 8, 9]; inarray = false; for (i = 0; i < $parentarray.length; i++) { if (pid == $parentarray[i]) { inarray = true; break; } } if (inarray) { $('.products .tabpage .tab li').eq(2).find('a').text('合作伙伴'); } else { $('.products .tabpage .tab li').eq(2).find('a').text('代理品牌'); } _agency = '
    '; $.each($agency, function (i, their) { _agency += '
    '; }); _agency += '
    '; $('.products .tabpage .pages').removeclass('fadeinright animated').addclass('fadeoutleft animated'); settimeout(function () { $('.products .tabpage .pages').find('.type').html(_description); $('.products .tabpage .pages').find('.units').html(_operator); $('.products .tabpage .pages').find('.brands').html(_agency); $('.products .tabpage .pages').find('.capacity').html(_capacity); // 核心能力 $('.products .tabpage .pages').find('.position').html(_position); // 行业地位 $('.products .tabpage .pages').find('.entity').html(_entity); // 运营单位 $('.products .tabpage .pages').find('.service').html(_service); // 优势服务 // 如果优势服务为空,隐藏该字段 var ad_services_display = $service ? "block" : "none" $('.products .tabpage .pages').find('.service').css({"display": ad_services_display}); $('.products .tabpage .pages').find('.service').prev().css({"display": ad_services_display}); $('.products .tabpage .pages').removeclass('fadeoutleft animated').addclass('fadeinright animated'); basic.animated(); }, 300); }); } } var news = { medianews: function () { $('.medianews li').each(function (i) { if (i % 2 == 0) { $(this).addclass('leftmd'); } else { $(this).addclass('rightmd'); } if (i % 4 == 0 || (i + 1) % 4 == 0) { $(this).addclass('bg'); } }); }, companynews: function () { if ($(window).width() > 480) { $('.companynews li').each(function (i) { if (i % 4 == 0 || (i + 1) % 4 == 0) { if (i % 4 == 0) { $(this).addclass('md4 leftmd'); } else { $(this).addclass('md4 rightmd'); } } else { $(this).addclass('md8'); } }); } } } var about = { response: function () { $('.response .block1 .tabpage .tabs li').eq(0).addclass('active'); $('.response .block1 .tabpage .pages dd').eq(0).addclass('active'); $('.response .tabpage .tabs li').on('click', function () { if ($(this).hasclass('active')) { // $(this).toggleclass('active'); $('.response .block1 .tabpage .pages').slidetoggle(); } else { $(this).addclass('active').siblings().removeclass('active'); $index = $(this).index(); if (!$('.response .block1 .tabpage .pages').is(':visible')) { $('.response .block1 .tabpage .pages').slidedown(); } $('.response .block1 .tabpage .pages .page').eq($index).addclass('active').siblings().removeclass('active'); } }); $('.response .tabpage').on('click', '.slideup', function () { $('.response .block1 .tabpage .pages').slideup(); }) }, jsonrender: function (json_data) { $.each(json_data, function (i, data) { if ($(window).width() > 480) { _animateclass = 'reach="fadeinright"'; } else { _animateclass = '' }; _animateclass = ''; $('.milestone .year').append('
  • ' + data.year + '
  • '); _temp = '
    ' + '
    ' + data.year + '
    '; $.each(data.data, function (n, date) { _temp += '

    ' + date.date + '

    ' + date.happend + '

    '; }); _temp += '
    '; $('.milestone .things').append(_temp); basic.animated(); }); }, milestone: function () { $('.milestone .year li').eq(0).addclass('active'); $('.milestone .things dl').eq(0).addclass('active'); // interact $('.milestone .year').on('click', 'li', function () { $(this).addclass('active').siblings().removeclass('active'); //while window's width > 768px do.. if (ww > 0) { index = $(this).index(); if (index > 0 && $('.milestone .year').scrolltop() > 0 && index - 2 <= $('.milestone .year').scrolltop() / $('.milestone .year li').outerheight()) { $yearscroll = $('.milestone .year').scrolltop() - $('.milestone .year li').outerheight() * 2; $('.milestone .year').animate({ scrolltop: $yearscroll }, 500); } else if (index < $('.milestone .year li').size() - 1 && $('.milestone .year').scrolltop() + $maxheight < $('.milestone .year li').size() * $('.milestone .year li').outerheight() && $('.milestone .year').scrolltop() / $('.milestone .year li').outerheight() + 3 <= index) { $yearscroll = $('.milestone .year li').outerheight() * 2 + $('.milestone .year').scrolltop(); $('.milestone .year').animate({ scrolltop: $yearscroll }, 500); } $year = $(this).text(); $offset = $('.milestone .things dl.year' + $year).offset().top - $('.milestone .things').offset().top + $('.milestone .things').scrolltop() - 30; $('.milestone .things').animate({ scrolltop: $offset }, 500); $('.milestone .things dl.year' + $year).addclass('active').siblings().removeclass('active'); } basic.animated(); // $('.milestone .things dl').nicescroll({ // cursorcolor:"#dadada", // background: '#fafafa', // cursorwidth: '5', // cursorborder:"#dadada", // cursorborderradius:"5", // cursoropacitymin: '0.5', // cursoropacitymax: '1', // horizrailenabled: false, // smoothscroll: false // }); }); // responce init style if (ww > 0) { $maxheight = $('.milestone .year li').outerheight() * 6; $('.milestone .year , .milestone .things').css({ height: $maxheight }); } }, gongsigaikuang: function () { $width = $('.gongsigaikuang .md4 .con').outerwidth(); $('.gongsigaikuang .md4 .con,.gongsigaikuang .md8 .con').css({ height: $width }); } } var index = { chain: function () { $('.index .supplychain .items').forslide({ step: 1, item: 'a', attr: 'eachdelay=".item" delaytime="100" ', callback: function () { $('.index .supplychain .items li').eq(0).addclass('active'); $size = $('.index .supplychain .items li').size(); for (i = 1; i <= $size; i++) { i == 1 ? $('.index .supplychain .pager ul').append('
  • ' + i + '
  • ') : $('.index .supplychain .pager ul').append('
  • ' + i + '
  • '); } } }); basic.animated(); canclick = true; $index_i = 0; $max = $('.index .supplychain .pager ul li').size() - 1; if ($index_i == 0 &&window.screen.width>768) { $timer = setinterval(function () { var v = document.getelementbyid('medio') v.currenttime = 0 v.play() $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.bannerarrows').find(".bx-next")[0].click(); }, 9000); } else { $timer = setinterval(function () { $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.bannerarrows').find(".bx-next")[0].click(); }, 4000); } // $timer = setinterval(function() { // $index_i+=1; // $index_i>$max ? $index_i = 0: null; // $('.index .supplychain .pager').find('li').eq($index_i).click(); // },4000); $('.index .supplychain .pager').on('click', 'li', function () { if (canclick) { clearinterval($timer); $current = $('.index .supplychain .pager li.active').index(); $eq = $(this).index(); $index_i = $eq; $(this).addclass('active').siblings().removeclass('active'); if ($eq > $current) { $('.index .supplychain .items li.active').find('.item').removeclass().addclass('item fadeoutleft animated'); canclick = false; settimeout(function () { $('.index .supplychain .items li.active').hide().removeclass('active'); $('.index .supplychain .items li').eq($eq).show().addclass('active').find('.item').removeclass().addclass('item fadeinright animated'); settimeout(function () { $('.index .banner .bx-controls').find('.bx-pager-item').eq($eq).find('a').click(); }, 100); canclick = true; if ($index_i == 0 &&window.screen.width>768) { var v = document.getelementbyid('medio') v.currenttime = 0 v.play() $timer = setinterval(function () { $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.index .supplychain .pager').find('li').eq($index_i).click(); }, 9000); } else { $timer = setinterval(function () { $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.index .supplychain .pager').find('li').eq($index_i).click(); }, 4000); } }, 600); } else if ($eq < $current) { $('.index .supplychain .items li.active').find('.item').removeclass().addclass('fadeoutright animated item'); canclick = false; settimeout(function () { $('.index .supplychain .items li.active').hide().removeclass('active'); $('.index .supplychain .items li').eq($eq).show().addclass('active').find('.item').removeclass().addclass('fadeinleft animated item'); settimeout(function () { $('.index .banner .bx-controls').find('.bx-pager-item').eq($eq).find('a').click(); }, 100); canclick = true; if ($index_i == 0 && window.screen.width>768) { var v = document.getelementbyid('medio') v.currenttime = 0 v.play() $timer = setinterval(function () { $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.index .supplychain .pager').find('li').eq($index_i).click(); }, 9000); } else { $timer = setinterval(function () { $index_i += 1; $index_i > $max ? $index_i = 0 : null; $('.index .supplychain .pager').find('li').eq($index_i).click(); }, 4000); } }, 600); } } }); }, banner: function () { if (ww > 768 || ww > 0) { var first = true; $('.index .bottom .trends .slides ul').forslide({ item: '.md4', pause: 5000, step: 3, clear: true, tagclass: 'row' }); $('.index .bottom .trends .slides ul').bxslider({ pager: false, auto: true, prevselector: $('.index .bottom .trends .arrows .prev'), nextselector: $('.index .bottom .trends .arrows .next'), prevtext: '', nexttext: '' }); if (ww > 768) { if ($(window).height() >= 700) { $('.index .banner .slider li').css({ height: $(window).height() - $('.index .bottom').outerheight() }); } else { $('.index .banner .slider li').css({ height: $(window).height() }); } $('.index .banner .slider li#zh_app_2023').remove(); } else { $('.index .banner .slider li').css({ height: $(window).height() - 50 }); $('.index .banner .slider li#first-v').remove(); $("[data-appsrc]").each(function (){ var that = $(this); var src = that.attr('data-appsrc'); that[0].style.backgroundimage = "url(" + src + ")"; }) } $sliderf = $('.index .banner .slider').bxslider({ mode: 'fade', auto: false, pause: 8000, speed: 1000, touchenabled: false, onsliderload: function () { $('.index .banner .slider li').eq(0).addclass('active'); $('.index .banner').find('.bx-controls .bx-pager-link').on('click',function (){ clearinterval($timer); $timer = setinterval(function () { $('.bannerarrows').find(".bx-next")[0].click(); }, 5000); }) if(!first){ const h1 = $('#zhsw').height(); const tp = $('#zhsw').offset().top; $('.index .banner').find('.bx-controls').css({ "height":h1+'px', "top":tp+'px' }) $('.index .banner').find('.bx-controls').addclass('active'); } }, onslideafter: function ($slideelement, oldindex, newindex) { if (newindex === 1&&first&&window.screen.width>768){ first = false; $('.index .banner .slider li#first-v').remove(); $sliderf.reloadslider(); }else{ $('.index .banner .slider li').removeclass('active').eq(newindex).addclass('active'); } }, onslidenext: function () { clearinterval($timer); $timer = setinterval(function () { $('.bannerarrows').find(".bx-next")[0].click(); }, 5000); }, onslideprev: function () { clearinterval($timer); $timer = setinterval(function () { $('.bannerarrows').find(".bx-next")[0].click(); }, 5000); }, prevselector: $('.index .banner .bannerarrows .arrows .prev'), nextselector: $('.index .banner .bannerarrows .arrows .next'), prevtext: '', nexttext: '' }); $('.index .banner .slider li').hide(); } } } var gobal = { active: function () { if (typeof (data_location) != 'undefined' && data_location != [] && data_location != '') { $top = data_location[0].nav_top; $left = data_location[0].nav_left; $leftsub = data_location[0].nav_left_sub; console.log($top) console.log($left) console.log($leftsub) $('.header .menu .menulist .list a').each(function () { if ($(this).text().indexof($top) >= 0) { $(this).parent('li').addclass('active'); } else { $(this).parent('li').removeclass('active'); } }); $('.content .left dd>ul>li>a').each(function () { if ($(this).text().indexof($left) >= 0) { $(this).parent('li').addclass('active'); } else { $(this).parent('li').removeclass('active'); } }); if ($leftsub != '') { $('.content .left dd li.active a').each(function () { if ($(this).text().indexof($leftsub) >= 0) { $(this).parent('li').addclass('active'); } }); } } }, touchswiper: function () { _current = $('.content .left>dl>dd>ul>.active').index(); gobal.switchmenu('null', _current); $('.content .left').swipe({ swipestatus: function (event, direction, distance, duration, fingercount, fingerdata) { gobal.switchmenu(distance, duration, direction); } }); }, switchmenu: function (side, distance, e) { //if(side=='null') { if (side == 'null' && $('.content>.left>dl>dd>ul>li').eq(_current).size() > 0) { _offset = $('.content>.left>dl>dd>ul>li').eq(_current).offset().left - (ww - $('.content>.left>dl>dd>ul>li').eq(_current).outerwidth()) / 2; $('.content .left dd').animate({ scrollleft: _offset }, 500); if ($('.content .left dd ul .active').find('.sub').size() > 0 && $(window).width() <= 1024) { _submenu = []; $('.content .left dd ul .active .sub >li').each(function () { _submenu.push($(this).prop('outerhtml')); }); $submenu = $(''); $.each(_submenu, function (k, v) { $submenu.append(v); }); $('.content .left').append($submenu); $('.thr').each(function(){ $(this).siblings('a').attr('href',"###") }); $('.thr').parent('li').on('click',function(){ if(!$(this).hasclass('on')){ $(this).addclass('on') }else{ $(this).removeclass('on') } }); if($('li.active').parent('.thr').length != undefined){ $('li.active').parent('.thr').parent('li').addclass('on active'); } } } if (e == 'start') { _offset = $('.content .left dd').scrollleft(); } else if (e == 'move') { if (side == 'left') { $('.content .left dd').finish(); $('.content .left dd').animate({ scrollleft: _offset + distance }, 100); } if (side == 'right') { $('.content .left dd').finish(); $('.content .left dd').animate({ scrollleft: _offset - distance }, 100); } } }, togglemenu: function () { $('.menulist .list li').each(function () { $(this).addclass('fadeinup animated'); }); $('.functions ul>li').each(function () { $(this).addclass('fadeindown animated'); }); $('.menubtn').click(function () { if ($('.menulist').size() > 1) { if ($('.top .menulist').is(':visible')) { $('.top .menulist').removeclass('fadeindown animated').addclass('fadeoutup animated'); settimeout(function () { $('.top .menulist').hide(); }, 300); } else { $('.top .menulist').show().removeclass('fadeoutup animated').addclass('fadeindown animated'); } } else { if ($('.menulist').is(':visible')) { $('.menulist').removeclass('fadeindown animated').addclass('fadeoutup animated'); settimeout(function () { $('.menulist').hide(); }, 300); } else { $('.menulist').show().removeclass('fadeoutup animated').addclass('fadeindown animated'); } } }); $('body').click(function () { if ($('.menulist').size() > 1) { if ($('.top .menulist').is(':visible')) { $('.top .menulist').removeclass('fadeindown animated').addclass('fadeoutup animated'); settimeout(function () { $('.top .menulist').hide(); }, 300); } else { if ($('.menulist').is(':visible')) { $('.menulist').removeclass('fadeindown animated').addclass('fadeoutup animated'); settimeout(function () { $('.menulist').hide(); }, 300); } } } }); $('.header,.index .banner').click(function (e) { e.stoppropagation(); }); }, bookmark: function () { if ($('[mark]').size() > 1 && $(window).width() > 1180) { var _bookmark = []; $('[mark]').each(function () { var _this = {}; _this.labelname = $(this).text(); _this.targetmark = $(this).attr('mark'); _this.icon = $(this).siblings('.iconfont').html(); _bookmark.push(_this); }); // console.dir(_bookmark); $('.content .right').append(''); $.each(_bookmark, function (i, label) { $bookmark = $('.content .right .bookmark'); if ($('a[name=' + label.targetmark + ']').size() == 1) { $bookmark.append('
  • ' + label.icon + '' + label.labelname + '
  • '); } else if ($('a[name=' + label.targetmark + ']').size() > 1) { console.log('书签%c ' + label.targetmark + ' %c存在多个锚点,这会导致滚动位置出错,检查拼写。', 'color:#fff; background: #f00;', ''); } else { console.log('书签%c ' + label.targetmark + ' %c不存在匹配的对应锚点,检查内容。', 'color:#fff; background: #f00;', ''); } }); $('.bookmark').on('click', '[targetmark]', function () { targetmark = $(this).attr('targetmark'); $('html,body').animate({ scrolltop: $('a[name=' + targetmark + ']').offset().top - $('.menu').height() - 20 }, 666); }); $bookmarktop = $('.bookmark').offset().top; $bookmarkleft = $('.bookmark').offset().left; timeout = ''; $(window).scroll(function () { clearinterval(timeout); if ($(window).scrolltop() >= $bookmarktop) { $('.bookmark').css({ position: 'fixed', left: $bookmarkleft }); timeout = settimeout(function () { $('.bookmark').stop().animate({ top: $('.menu').height() }, 200); }, 100); } else { $('.bookmark').css({ position: 'absolute', top: 0, left: '100%' }); } }); } }, menufix: function () { if (scrollx >= _setting.menufixtriger && $(window).width() > 1024) { $('.header').addclass('ontop'); } else { $('.header').removeclass('ontop'); } }, terms: function () { $(window).keyup(function (e) { if (e.keycode == '27') { $('.terms').fadeout(); } }); $('.terms').click(function () { $(this).fadeout(); }); $('.terms .win').click(function (e) { e.stoppropagation(); }); }, sitemap: function () { $(window).keyup(function (e) { if (e.keycode == '27') { $('.sitemap').fadeout(); } }); $('.sitemap').click(function () { $(this).fadeout(); }); $('.sitemap .win').click(function (e) { e.stoppropagation(); }); } } /*按比例尺寸*/ $.fn.ratio = function ($option) { var $setting = { scale: 3 / 4 } $.extend($setting, $option); var $obj = this; $width = parseint($obj.width()); $height = $width * $setting.scale; $obj.css({ 'height': $height, 'overflow': 'hidden' }); } /*dom分割*/ $.fn.forslide = function (_option) { _temp = ''; _html = ''; var _setting = { item: '.item', step: 4, tagname: 'li', tagclass: '', clear: false, attr: '', callback: function () { } } $.extend(_setting, _option); o = this; _size = o.find(_setting.item).size(); if (_setting.clear) { _clear = '
    '; } else { _clear = ''; } if (_size > _setting.step) { if (_size % _setting.step == 0) { for (_i = 0; _i < _size; _i++) { _temp += o.find(_setting.item + ':eq(' + _i + ')').prop('outerhtml'); if ((_i + 1) % _setting.step == 0) { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; _temp = ''; } } } else { _page = math.floor(_size / _setting.step); for (_i = 0; _i < _size; _i++) { _temp += o.find(_setting.item + ':eq(' + _i + ')').prop('outerhtml'); if ((_i + 1) % _setting.step == 0 && _i + 1 <= _page * _setting.step) { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; _temp = ''; } } _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + _temp + _clear + ''; } } else { _html += '<' + _setting.tagname + ' ' + _setting.attr + ' class="' + _setting.tagclass + '">' + o.html() + ''; } o.empty().append(_html); _setting.callback(); } var basic = { table: function () { $('table').each(function () { if ($(this).attr('responsetable')) { _attr = $(this).get(0).attributes; _class = $(this).attr('class'); _class ? null : _class = 'normal'; if ($(this).find('tr').eq(0).find('th').size() > 1) { side = 'shu'; istable = true; } else if ($(this).find('tr').eq(0).find('th').size() == 1) { side = 'heng'; istable = true; } else { istable = false; } if (istable && side == 'shu') { _ths = []; $(this).find('tr').eq(0).find('th').each(function () { _ths.push($(this).text()); }); _trs = []; $(this).find('tr').each(function (i) { _tds = []; if (i != 0) { $(this).find('td').each(function () { _tds.push($(this).text()); }); _trs.push(_tds); } }); // 生成html $table = $('
    '); $tr = $('
    '); $.each(_ths, function (k, v) { $th = $('
    ').append($('' + v + '')); $tr.append($th); }); $table.append($tr); $.each(_trs, function (row, rowdata) { row++; $tr = $('
    '); $.each(rowdata, function (k, v) { $td = $('
    ').append($('' + _ths[k] + '')).append($('' + v + '')); $tr.append($td); }); $table.append($tr); }); $.each(_attr, function (k, v) { $table.attr(v.nodename, v.value); }); $table.addclass('table hengtable'); $(this).replacewith($table); } else if (istable && side == 'heng') { _ths = []; _this = $(this); _trs = []; $(this).find('tr').each(function (i) { _trs[i] = []; _ths.push($(this).find('th').text()); $(this).find('td').each(function () { _trs[i].push($(this).text()); }); }); console.dir(_trs); //生成html $table = $('
    '); $column = $('
    '); $.each(_ths, function (k, v) { columnnum = k + 1; $column.append($('
    ' + v + '
    ')); }); $table.append($column); $.each(_trs[0], function (k) { console.log(k); columnnum = k + 1; $column = $('
    '); $.each(_trs, function (row, data) { $column.append($('
    ' + _ths[row] + '' + data[k] + '
    ')); }); $table.append($column); }); $.each(_attr, function (k, v) { $table.attr(v.nodename, v.value); }); $table.addclass('table shutable'); $(this).replacewith($table); } } }); }, lazyload: function () { $('[lazyload]').each(function () { if (!$(this).attr('src')) { $(this).css({ "background": "url(" + _setting.imgurl + "bx_loader.gif) no-repeat center center" }); } if ($(this).offset().top - $(window).height() <= $(window).scrolltop()) { if (!$(this).attr('src')) { $(this).attr("src", $(this).attr("lazyload")); if (_setting.toggleimagesize) { var img_url = $(this).attr('src'); obj = $(this); var img = new image(); img.src = img_url; var check = function () { if (img.width > 0 || img.height > 0) { obj.attr('data-width', img.width); obj.attr('data-height', img.height); clearinterval(set); } }; var set = setinterval(check, 40); } } } $(this).load(function () { $(this).css({ "background": "none" }); }); }); }, imgsize: function () { imgamount = $('img[src]').size(); renderid = 0; loadnext = function (obj) { var img_url = obj.attr('src'); var img = new image(); img.src = img_url; var check = function () { if (img.width > 0 || img.height > 0) { obj.attr('data-width', img.width); obj.attr('data-height', img.height); clearinterval(set); renderid++; renderid < imgamount ? loadnext($('img').eq(renderid)) : null; } }; var set = setinterval(check, 40); } loadnext($('img').eq(renderid)); }, grids: function () { $css = []; $('.row').each(function () { mds = '.md1,.md2,.md3,.md4,.md5,.md6,.md7,.md8,.md9,.md10,.md11,.md12,.dv'; per = 100 / $(this).find('.dv').size(); $(this).find('.dv').css({ width: per + '%' }); $(this).find(mds).each(function () { $html = $(this).html(); $margin = $(this).css('margin'); $(this).addclass('mp0'); $(this).html('
    ' + $html + '
    '); if ($margin != '0px') { /*获取父级的所有class*/ $thisclass = '.' + $(this).attr('class').replace(/\s+/g, "."); $parent = $(this).parents('[class]'); $parentclass = []; if ($parent.attr('class')) { $parentclass.push($parent.attr('class').replace(/\s+/g, ".")); } for (i = 0; i < 5; i++) { $parent = $parent.parents('[class]'); if ($parent.attr('class')) { $parentclass.push($parent.attr('class').replace(/\s+/g, ".")); } } $parentclasses = ''; for (i = $parentclass.length - 1; i > 0; i--) { $parentclasses += '.' + $parentclass[i] + ' '; } $thisclasspath = $tcp = $parentclasses + $thisclass; $thiscss = $thisclasspath + ' .item {margin: ' + $margin + '}'; $css.push($thiscss); } }); }); /*插入css到head*/ $ncss = []; for (var i = 0; i < $css.length; i++) { var items = $css[i]; //判断元素是否存在于new_arr中,如果不存在则插入到new_arr的最后 if ($.inarray(items, $ncss) == -1) { $ncss.push(items); } } $css = ''; for (i = 0; i < $ncss.length; i++) { $css += $ncss[i]; } $('').insertbefore('head'); }, devicerotate: function () { if (mobile()) { window.addeventlistener("onorientationchange" in window ? "orientationchange" : "resize", function () { // if (window.orientation === 180 || window.orientation === 0) { // $('body').addclass('vertical'); // } // if (window.orientation === 90 || window.orientation === -90 ){ // $('body').addclass('horizontal'); // } window.location.reload(true); }, false); } }, animated: function () { $('[firstactive]').each(function () { $tar = $(this).attr('firstactive'); $(this).find($($tar)).eq(0).addclass('active'); }); $('[prefix]').each(function () { $prefix = $(this).attr('prefix'); if ($(this).attr('child')) { $child = $(this).attr('child'); $(this).find($child).each(function (_i) { _i += 1; $(this).addclass($prefix).addclass($prefix + _i); }); } else { $(this).each(function (_i) { _i += 1; $(this).addclass($prefix).addclass($prefix + _i); }); } }); $('[split]').each(function () { _temp = []; _html = ''; if ($(this).attr('rendered') == 'true') { } else { $tar = $(this).attr('split'); $text = $(this).text(); for (i = 0; i < $text.length; i++) { _temp.push($text.substring(i, i + 1)); } for (i = 0; i < _temp.length; i++) { if (_temp[i] == "#") { _html += '
    '; } else { _html += '<' + $tar + '>' + _temp[i] + ''; } } $(this).html(_html); $(this).attr('rendered', 'true'); } }); $('[breakas]').each(function () { _temp = []; _text = []; _html = ''; typeof ($(this).attr('tagclass')) != 'undefined' ? _class = ' class="' + $(this).attr('tagclass') + '" ' : _class = ''; $tagname = $(this).attr('breakas'); $text = $(this).text(); _temp = $text.split('#'); $.each(_temp, function (k, v) { _text[k] = v.split(" "); }); console.dir(_text); $.each(_text, function (k, line) { $.each(line, function (a, word) { _html += '<' + $tagname + ' ' + _class + '>' + word + ' '; }); _html += '
    '; }); $(this).html(_html); }); $('[goto]').each(function () { $(this).on('click', function () { $tar = $(this).attr('goto'); $("html,body").animate({ scrolltop: $($tar).offset().top }, 1000); }); }); $('[vcenter]').each(function () { tar = $(this).attr('vcenter'); _html = $(this).find(tar).prop('outerhtml'); $(this).html('
    '); $(this).find('table').append('' + _html + ''); }); $('[absovcenter]').each(function () { $target = $(this).attr('absovcenter'); $position = $(this).css('position'); if ($position != 'absolute' && $position != 'relative' && $position != 'fixed') { $(this).css({ position: 'relative' }); } $targetheight = $(this).find($target).outerheight(); $(this).find($target).css({ position: 'absolute', top: '50%', margintop: -$targetheight / 2 }); }); $('[imgvcenter]').each(function () { tar = $(this).attr('imgvcenter'); outheight = $(this).height(); $(this).find(tar).load(function () { inheight = $(this).outerheight(); $(this).css({ 'margin-top': (outheight - inheight) / 2 }); }); }); $('[eachdelay]').each(function () { delaytarget = $(this).attr('eachdelay'); delaytime = $(this).attr('delaytime') / 1000; if (typeof ($(this).attr('delaystart')) != 'undefined') { delay = parseint($(this).attr('delaystart')) / 1000; } else { delay = 0; } $(this).find(delaytarget).each(function () { $(this).css({ 'animation-delay': delay + 's', '-webkit-animation-delay': delay + 's', '-o-animation-delay': delay + 's', '-moz-animation-delay': delay + 's' }); delay += delaytime; }); }); $('[hover]').each(function () { $(this).mouseenter(function () { animate = $(this).attr('hover'); if ($(this).attr("effect")) { effectchild = $(this).attr("effect"); $(this).find(effectchild).addclass(animate + " animated"); } else { $(this).addclass(animate + " animated"); } }); $(this).mouseleave(function () { animate = $(this).attr('hover'); if ($(this).attr("effect")) { effectchild = $(this).attr("effect"); $(this).find(effectchild).removeclass(animate + " animated"); } else { $(this).removeclass(animate + " animated"); } }); }); $('[animate]').each(function () { animate = $(this).attr('animate'); if (animate.indexof(',') >= 0) { arr = animate.split(','); } else { arr = ["fadein", "zoomin", "fadeinup", "fadeinright", "fadeindown", "fadeinleft"]; } $(this).attr('animateclass') ? animateclass = $(this).attr('animateclass') : animateclass = ''; if ($(this).attr('effect')) { if (animate == "random" || animate.indexof(',') >= 0) { $(this).find($(this).attr('effect')).each(function () { random = math.floor(math.random() * (arr.length)); random = arr[random]; $(this).addclass(random + ' animated ' + animateclass); }); } else { $(this).find($(this).attr('effect')).addclass(animate + ' animated ' + animateclass); } } else { $(this).addclass(animate + ' animated ' + animateclass); } }); $('[reach]').each(function () { if ($(document).scrolltop() + $(window).height() >= $(this).offset().top) { animate = $(this).attr('reach'); $(this).attr('animateclass') ? animateclass = $(this).attr('animateclass') : animateclass = ''; if (animate.indexof(',') >= 0) { arr = animate.split(','); } else { arr = ["fadein", "zoomin", "fadeinup", "fadeinright", "fadeindown", "fadeinleft"]; } if ($(this).attr("effect")) { effectchild = $(this).attr("effect"); $(this).find(effectchild).each(function () { if (animate == "random" || animate.indexof(',') >= 0) { random = math.floor(math.random() * (arr.length)); random = arr[random]; $(this).addclass(random + " animated " + animateclass); } else { $(this).addclass(animate + " animated " + animateclass); } }); $(this).find(effectchild).css({ 'visibility': 'visible' }); } else { $(this).addclass(animate + " animated " + animateclass); $(this).css({ 'visibility': 'visible' }); } // $(this).removeattr('reach'); } }); $(window).scroll(function () { topval = $(document).scrolltop(); $('[reach]').each(function () { if (topval > $(this).offset().top - $(window).height()) { animate = $(this).attr('reach'); if ($(this).attr("effect")) { effectchild = $(this).attr("effect"); $(this).find(effectchild).addclass(animate + " animated"); $(this).find(effectchild).css({ 'visibility': 'visible' }); } else { $(this).addclass(animate + " animated"); $(this).css({ 'visibility': 'visible' }); } } else { animate = $(this).attr('reach'); if ($(this).attr("effect")) { effectchild = $(this).attr("effect"); $(this).find(effectchild).removeclass(animate + " animated"); $(this).find(effectchild).css({ 'visibility': 'hidden' }); } else { $(this).removeclass(animate + " animated"); $(this).css({ 'visibility': 'hidden' }); } } }); }); } } function dir(e) { console.dir(e); } function log(e) { console.log(e); } function version() { var explorer = window.navigator.useragent; if (explorer.indexof("msie") >= 0 || explorer.indexof("trident") > 0) { if (explorer.indexof("msie 5") > 0 || explorer.indexof("msie 6") > 0 || explorer.indexof("msie 7") > 0 || explorer.indexof("msie 8") > 0) { return 'lowerieversion'; } else { return 'edgeortrident'; } } else if (explorer.indexof("maxthon") >= 0) { return 'maxthon'; } else if (explorer.indexof("firefox") >= 0) { return 'firefox'; } else if (explorer.indexof("chrome") >= 0) { return 'chrome'; } else if (explorer.indexof("opera") >= 0) { return 'opera'; } else if (explorer.indexof("safari") >= 0) { return 'safari'; } } function mobile() { var useragentinfo = navigator.useragent; var agents = ["android", "iphone", "symbianos", "windows phone", "ipad", "ipod"]; var flag = false; for (var v = 0; v < agents.length; v++) { if (useragentinfo.indexof(agents[v]) > 0) { flag = true; break; } } // var isandroid = useragentinfo.indexof('android') > -1; // var isios = !!useragentinfo.match(/(\(i[^;]+;( u;)? cpu.+mac os x)|renrenche/); return flag; } function mousewheel() { $('body').append(repeat('
    ', 200)); $('body').mousewheel(function (event, delta) { log(delta); }); } function nicescroll() { $('body').nicescroll({ cursorcolor: "none", background: 'none', cursorwidth: '5', cursorborder: "none", cursorborderradius: "0", cursoropacitymin: '0.5', cursoropacitymax: '1', horizrailenabled: false, smoothscroll: false }); } function banscroll() { if ($('body').hasclass('banscroll')) { $('body').getnicescroll(0).locked = true; } else { $('body').getnicescroll(0).locked = false; } } function limit(text, length, overflow) { if (!overflow) { overflow = '...'; } if (!length) { length = 10; } return text.substr(0, length) + overflow; } function repeat(text, x) { var $temp = []; x |= 1; for (var i = 0; i <= x; $temp[i++] = ''); return $temp.join(text); } var $template = { render: function (tpl, data) { var temp = []; for (var i = 0; i < data.length; i++) { temp.push($template.htmltemplate(tpl, data[i])); } return temp.join(""); }, htmltemplate: function (template, data, allowempty, chats) { var regexp; chats = chats || ['\\$\\{', '\\}']; regexp = [chats[0], '([_\\w]+[\\w\\d_]?)', chats[1]].join(''); regexp = new regexp(regexp, 'g'); return template.replace(regexp, function (s, s1) { if (data[s1] != null && data[s1] != undefined) { return data[s1]; } else { return allowempty ? '' : s; } }); } } var $cookie = { set: function (c_name, value, expiredays) { var exdate = new date() exdate.setdate(exdate.getdate() + expiredays) document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.togmtstring()) }, get: function (c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexof(c_name + "=") if (c_start != -1) { c_start = c_start + c_name.length + 1 c_end = document.cookie.indexof(";", c_start) if (c_end == -1) { c_end = document.cookie.length } return unescape(document.cookie.substring(c_start, c_end)) } } return false; } } function changecountry(countryname) { if (countryname != '') { $.post('network.html', { getprovince: 1, countryname: countryname }, function (data, textstatus) { if (textstatus == "success") { //$("#kprovince").val==''; $("#province").html(data); $("#city").html(''); } }); } else { $("#province").html(''); $("#city").html(''); } } function changeprovince(provincename) { if (provincename != '') { $.post('network.html', { getcity: 1, provincename: provincename }, function (data, textstatus) { if (textstatus == "success") { $("#city").val == ''; $("#city").html(data); } }); } else { $("#city").html(''); } } $().ready(function () { $("input,textarea").keydown(function () { $("#respond").html(""); }); //$("input,textarea").keydown(function(){$(this).removeclass("no");}); $("#feedback_btn").click(function () { if ($("#allowed").val() != 1) { return false; } $("#allowed").val(0); //$("#respond").html("留言提交中..."); var title = $('#title').val(), tel = $('#tel').val(), contact_name = $('#contact_name').val(), email = $('#email').val(), message = $('#message').val(), salt = $('#salt').val(); $.post('question.html', { feedback: 1, title: title, tel: tel, contact_name: contact_name, email: email, message: message, salt: salt }, function (data, textstatus) { if (textstatus == "success") { if (data['success'] == 1) { $("#title").removeclass("no"); $("#tel").removeclass("no"); $("#message").removeclass("no"); $("#respond").html("您的留言我们已收到"); $(':input').not(':hidden,:button').val(''); $("#allowed").val(1); } else { if (data['title'] == 1) { $("#title_area").addclass("no"); } else { $("#title_area").removeclass("no"); } if (data['tel'] == 1) { $("#tel_area").addclass("no"); } else { $("#tel_area").removeclass("no"); } if (data['contact_name'] == 1) { $("#contact_name_area").addclass("no"); } else { $("#contact_name_area").removeclass("no"); } if (data['email'] == 1) { $("#email_area").addclass("no"); } else { $("#email_area").removeclass("no"); } if (data['message'] == 1) { $("#message_area").addclass("no"); } else { $("#message_area").removeclass("no"); } //$("#respond").html("请重新输入"); $("#allowed").val(1); } return false; } }, 'json'); }); if($(window).width() > 1024){ console.log('dang') if($('li.active').parent('.thr').length != undefined){ $('li.active').parent('.thr').parent('li').addclass('on'); } } }); function wxshare() { wx.onmenushareappmessage({ title: _share, desc: _desc, link: _link, imgurl: _imgurl, success: function (res) { sharesuccess(); }, fail: function (res) { //alert(_shareerr); } }); wx.onmenusharetimeline({ title: _share, link: _link, imgurl: _imgurl, success: function (res) { sharesuccess(); }, fail: function (res) { //alert(_shareerr); } }); wx.onmenushareqq({ title: _share, desc: _desc, link: _link, imgurl: _imgurl, success: function (res) { sharesuccess(); }, fail: function (res) { //alert(_shareerr); } }); wx.onmenushareweibo({ title: _share, desc: _desc, link: _link, imgurl: _imgurl, success: function (res) { sharesuccess(); }, fail: function (res) { //alert(_shareerr); } }); } // (全局)下拉时给左侧导航增加固定效果 $(function () { $(window).resize(function() { console.log('拖动窗口') let logoleft = $('.logo').offset().left; if ($('.content').offset().top - $(window).scrolltop() - 60 <= 0 ) { $('.left').css({ position:'fixed', left:logoleft + 'px', top:'60px' }) } }); if($(window).width() >= 1024){ $(window).scroll(function () { if ($('.content').offset().top - $(window).scrolltop() - 60 <= 0 ) { if(! $('.left').hasclass('on')){ $('.left').addclass('on'); let lleft = $('.content').offset().left; $('.left').css({ position:'fixed', left:lleft + 'px', top:'60px' }) } } else { $('.left').removeclass('on'); $('.left').css({ position:'absolute', left:'0', top:'0' }) } }); } })