// javascript document var data={//全局变量 _vw:$(window).width(), _vh:$(window).height(), _en:$('html').hasclass('en'), _type:5, rownode:[], node:$('.nodeitem'), gotop:$('.go-top'), _home:$('#home'), _about:$('#about'), _history:$('#history'), _honor:$('#honor'), _qa:$('#qa'), _agg:$('#agg'), _job:$('#job'), _branch:$('#branch'), _branch_detail:$('#branch_detail'), _branch_detail_1:$('#branch_detail_1'), _service_area:$('#service_area') }; var _delaytop = 0; var init=function(){ $(".go-top").click(function(){ if ($('html').scrolltop()) { $('html').animate({ scrolltop: 0 }, 100);//动画效果 return false; } $('body').animate({ scrolltop: 0 }, 100); return false; }); // initfn.nav(); initfn.app_nav(); if(data.node.length>0){ var name = $('.row'); for(var n=0;n0){ branchfn.tab(); } if(data._about.length>0){ // if(window.innerwidth<800){ // initfn.play(); // } } if(data._history.length>0){ historyfn.time(); } if(data._honor.length>0){ honorfn._hover(); } if(data._qa.length>0){ if(base.ispc){ qafn.go_down(); } } if(data._job.length>0){ jobfn.go_down(); } if(data._agg.length>0){ branchfn.tab(); } if(data._branch.length>0){ branchfn.tab(); branchfn.list_down(); branchfn.map_search(); } if(data._branch_detail.length>0){ detailfn.loop(); } if(data._branch_detail_1.length>0){ detail_1_fn.loop(); branchfn.tab(); } if(data._service_area.length>0){ branchfn.tab(); } }); $(window).bind("scroll",function(){ var _wtop = _winscroll = windowpos = $(window).scrolltop(); if(_wtop>400&&window.innerwidth>1024){ $("header").addclass("active"); data.gotop.addclass("on"); }else{ $("header").removeclass("active"); data.gotop.removeclass("on"); } if(_wtop>200){ data.node.addclass('on'); }else{ data.node.removeclass('on'); } for(var i=data.rownode.length-1;i>=0;i--){ var _this = data.rownode[i]; if(_wtop>=_this.top){ data.node.find('a').eq(i).addclass('on').siblings().removeclass('on'); break; } } _delaytop = _wtop; }); var initfn={ nav:function () { var box = $('.nav_box_pc'), _ani = false, down = box.find('.nav-down'), _child = box.find('.nav-child'); down.on('click',function () { if(_ani) return false; _ani = true; _child.removeclass('out').addclass('on'); settimeout(function () { _ani = false; },800); }); box.on('mouseleave',function () { if(_ani) return false; if(_child.hasclass('on')){ _ani = true; _child.removeclass('on').addclass('out'); settimeout(function () { _ani = false; },800); } }) }, app_nav:function () { var _app = $('.nav-app'), child = _app.find('.go-child'), mask = _app.find('.mask'), _btn = $('.nav_box_m_btn span'); _btn.on('click',function(e){ // $(this).addclass('close'); _app.addclass('on'); }); mask.on('click',function () { _app.removeclass('on'); // _btn.removeclass('close'); }) child.on('click',function () { var _this = $(this), _c = _this.siblings('.go-child'), _down = _this.next(), _other = _down.siblings('.nav-down'); _this.toggleclass('on');_c.removeclass('on'); _down.slidetoggle();_other.slideup(); }) }, play:function () { var _btn = $('.play'); var _pop = $('#pop'), _close = $('._close'), _v = _pop.find('.media'); _btn.on('click',function () { var _this = $(this), _src = _this.attr('data-src'); _pop.addclass('on'); _v.attr('src',_src); _v[0].load(); }); _close.on('click',function () { $(this).parents('#pop').removeclass('on'); _v.attr('src',''); }); } }; var historyfn = { time:function () { var _parent = $('#time-fn'), timer = null, _go = 100, _box = _parent.find(".time-date"), _list = _parent.find('.time-list'), _msglist = _parent.find('.time-note').find('ul'), _len = _list.length, t_prev = _parent.find('.t-prev'), t_next = _parent.find('.t-next'), _w = window.innerwidth*0.2; var arr=[-1,0,1]; _list.eq(1).attr('data-fn','next'); t_next.on('click',function () { go('next'); }); t_prev.on('click',function () { go('prev'); }); _list.on('mouseenter',function () { var type = $(this).attr('data-fn'); if(type=='next'){ timer = settimeout(function () { go('next'); _go = 500; },_go); } else if(type=='prev'){ timer = settimeout(function () { go('prev'); _go = 500; },_go); } }); _list.on('mouseleave',function () { cleartimeout(timer); }); function go(type) { _list.removeattr('data-fn'); for(var key in arr){ var _this = arr[key]; if(type=='next'){ _this = _this < (_len-(2-key)) ? (_this+1) : (_len-(2-key)); }else if(type=='prev'){ _this = _this > (2+(key-3)) ? (_this-1) : (2+(key-3)); } arr[key] = _this; if(key==1){ _list.eq(_this).addclass('on').siblings().removeclass('on'); _box.css('left',(38 - _this*24)+'%'); _msglist.eq(_this).addclass('on').siblings().removeclass('on'); _list.eq(_this).removeattr('data-fn'); }else if(key==0){ _list.eq(_this).addclass('on1').siblings().removeclass('on1'); _list.eq(_this).attr('data-fn','prev'); }else{ _list.eq(_this).addclass('on2').siblings().removeclass('on2'); _list.eq(_this).attr('data-fn','next'); } } } } }; var honorfn={ _hover:function () { var box = $('#fn1'), _list = box.find('li'); _list.on('mouseenter',function () { $(this).addclass('on').siblings().removeclass('on'); }) } }; var qafn={ go_down:function () { var box = $('.go-down'); var $jobnum = null, msg = $('.p-msg'), _heiitem = []; msg.each(function () { var that = $(this), _list = that.find('.p-bg'), _hei = that.find('.p-bg').height()+1; _heiitem.push(_hei); _list.css('height','26px'); if(_hei>30){ that.addclass('over'); }else{ that.parents('.qa-list').find('.go-down').hide(); } }); box.on('click',function(){ var item = $('.p-bg'), _this = $(this), num = _this.attr('data-num'), _that = item.eq((num-1)); if(num!=$jobnum){ item.css('height','26px'); msg.removeclass('on'); box.removeclass('on'); _that.css('height',_heiitem[num-1]+'px'); msg.eq((num-1)).toggleclass('on'); _this.toggleclass('on'); $jobnum = num; }else{ if(_that.height()>30){ _that.css('height','26px'); }else{ _that.css('height',_heiitem[num-1]+'px'); } msg.eq((num-1)).toggleclass('on'); _this.toggleclass('on'); } }); } }; var jobfn={ go_down:function () { var box = $('.go-down'); var $jobnum = null; box.on('click',function(){ var item = $('.p-msg'), _this = $(this), num = _this.attr('data-num'); if(num!=$jobnum){ item.slideup(); box.removeclass('on'); item.eq((num-1)).slidetoggle(); _this.toggleclass('on'); $jobnum = num; }else{ item.eq((num-1)).slidetoggle(); _this.toggleclass('on'); } }); } }; var branchfn={ tab:function () { var box = $('.tab'), _list = $('.tab-list'); box.children().on('click',function () { var n = $(this).index(); var type = $(this).attr('data-type'); if(type){ data._type = type; } _on($(this)); _on(_list.eq(n)); }); if(base.ispc){ box.children().on('mouseenter',function () { var n = $(this).index(); var type = $(this).attr('data-type'); if(type){ data._type = type; } _on($(this)); _on(_list.eq(n)); }); } }, map_search:function () { var _box = $('.map_search'); var src = null; if(data._en){ src = "/en/branch"; }else{ src = "/branch"; } _box.each(function () { var _this = $(this), _in = _this.prev(), _cl = _this.next(); _in.on('input',function () { var _val = $(this).val(), _reset = $(this).nextall('.reset'); if(_val){ _reset.addclass('on'); }else{ _reset.removeclass('on'); } }) _cl.on('click',function () { var _items = $(this).parents('.con').find('.adr-items').find('li'), dots = $(this).parents('.con').find('.dot-item').find('li'); _in.val(''); $(this).removeclass('on'); _items.addclass('active'); }) _this.on('click',function () { var _data = _in.val(), _items = $(this).parents('.con').find('.adr-items').find('li'); $.post(src, { map: data._type, keywords: _data }, function(result){ var _res = eval('('+result+')'); _items.removeclass('active'); for(var key in _res){ var that = parseint(_res[key].vid); _items.each(function () { var _id = parseint($(this).attr('data-id')); if(_id == that){ $(this).addclass('active'); } }); } }); }); }); }, list_down:function () { var box = $('.adr-items'); function xm(type,img1,img2) { if(type === 'xm'){ img1.addclass('on'); img2.removeclass('on'); }else{ img2.addclass('on'); img1.removeclass('on'); } } if(base.ispc){ box.each(function () { var _this = $(this), _parent = _this.parents('.tab-list'), _img1 = _parent.find('img.xm'), _img2 = _parent.find('img.china'), dots = _parent.find('.dot-item').find('li'), _list = _this.find('li'), _type = _list.eq(0).attr('data-type'); xm(_type,_img1,_img2); dots.each(function () { var _v = $(this).attr('data-type'); if(_v === _type){ $(this).show(); }else{ $(this).hide(); } }); _list.on('mouseenter',function () { var that = $(this); _on(that); var n = that.attr('data-id'), type = that.attr('data-type'); xm(type,_img1,_img2); dots.each(function () { var v = $(this).attr('data-type'); if($(this).attr('data-id')==n){ _on($(this)); } if(v === type){ $(this).show(); }else{ $(this).hide(); } }); }) }); }else{ box.each(function () { var _this = $(this), _parent = _this.parents('.tab-list'), _img1 = _parent.find('img.xm'), _img2 = _parent.find('img.china'), dots = _parent.find('.dot-item').find('li'), _list = _this.find('li'), _type = _list.eq(0).attr('data-type'); xm(_type,_img1,_img2); dots.each(function () { var _v = $(this).attr('data-type'); if(_v === _type){ $(this).show(); }else{ $(this).hide(); } }); _list.on('click',function () { var that = $(this); _on(that); var n = that.attr('data-id'), type = that.attr('data-type'); xm(type,_img1,_img2); dots.each(function () { var v = $(this).attr('data-type'); if($(this).attr('data-id')==n){ _on($(this)); } if(v === type){ $(this).show(); }else{ $(this).hide(); } }); }) }); } } }; var detailfn={ loop:function () { var box = $('#loop'), _pic = box.find('.pic'), _list = box.find('.msg-list'), _tab = box.find('.tab').find('li'); _tab.on('mouseenter',function () { var n = $(this).index(); _on($(this));_on(_list.eq(n));_on(_pic.eq(n)); }) } }; var detail_1_fn={ loop:function () { var loop = function (opts) { var parent = opts.parent, prev = parent.find('.prev'), next = parent.find('.next'), box = parent.find('.swiper'), item = box.find('ul'), cur = 0, isani = false, list = item.find('li'), wid = list.eq(0).width(), length = list.length - 1; prev.on('click',function () { swiper_go(cur,'prev'); }); next.on('click',function () { swiper_go(cur,'next'); }); list.on('mouseenter',function () { var n = parseint($(this).attr('data-key'))-1; _on(list.eq(n)); }); function swiper_go(index,type) { if(isani) return false; isani = true; var left = 0; if(type == 'prev'){ var cur_list = item.find('li').eq(length); cur = index>0 ? (index-1) : length; item.css("margin-left",-wid); item.prepend(cur_list); item.animate({ marginleft:0 },350); } if(type == 'next'){ var cur_list = list.eq(cur); cur = index