/*****************/ function stopbubble(e) { // 如果传入了事件对象,那么就是非ie浏览器 if (e && e.stoppropagation) { //因此它支持w3c的stoppropagation()方法 e.stoppropagation(); } else { //否则我们使用ie的方法来取消事件冒泡 window.event.cancelbubble = true; } } var tap = 'ontouchstart' in document ? 'touchend' : 'click'; var winwt = parseint($(window).width()), winht = parseint($(window).height()); //实现滚动条无法滚动 var winhadntscroll = function (e) { e.preventdefault(); }; /***禁止滑动***/ function scrollstop() { var h = $(window).height(); document.body.style.overflow = 'hidden'; document.addeventlistener("touchmove", winhadntscroll , { passive: false }); //禁止页面滑动 } /***取消滑动限制***/ function scrollmove() { document.body.style.overflow = ''; //出现滚动条 document.removeeventlistener("touchmove", winhadntscroll , { passive: false }); } /// 锚点跳转 function anchormove(id, fn) { var $obj = $(id), movefun = fn; var oh = $obj.offset().top - parseint($('.header').outerheight()); $('html,body').animate({ scrolltop: oh }, 300, function () { if (movefun) movefun(); }); }; /// 竖向滚动条 if ($('.scrollbox').length > 0) { $('.scrollbox').mcustomscrollbar({ scrollinertia: 1000, advanced: { updateoncontentresize: true } }); if(winwt < 992){ $('.scrollbox').mcustomscrollbar("destroy"); } } /// 横向滚动条 if ($('.scrollbox2').length > 0) { $('.scrollbox2').mcustomscrollbar({ axis: "x", mousewheel: true, advanced: { updateoncontentresize: true } }); if(winwt < 992){ $('.scrollbox2').mcustomscrollbar("destroy"); } } // 页面滚动wow.js再ie9以上引用 var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset: 10, mobile: true, live: true }); if (!(/msie [6|7|8|9]/i.test(navigator.useragent))) { wow.init(); }; // 模态框 $('.modal').on('shown.bs.modal', function(){ $('body').addclass('modal-open'); }); $('.modal').on('hidden.bs.modal', function () { if($(this).find('video').length){ var videoid = $(this).find('.video-js').attr('id'); var myplayer = videojs(videoid); myplayer.pause(); myplayer.currenttime(0); } }); $('.modal-close').off(tap).on(tap, function(){ var $modal = $(this).parents('.modal'); $modal.modal('hide'); }); // 判断设备 var os = function (){ var ua = navigator.useragent, iswindowsphone = /(?:windows phone)/.test(ua), issymbian = /(?:symbianos)/.test(ua) || iswindowsphone, isandroid = /(?:android)/.test(ua), isios = !!ua.match(/\(i[^;]+;( u;)? cpu.+mac os x/), isfirefox = /(?:firefox)/.test(ua), ischrome = /(?:chrome|crios)/.test(ua), istablet = /(?:ipad|playbook)/.test(ua) || (isandroid && !/(?:mobile)/.test(ua)) || (isfirefox && /(?:tablet)/.test(ua)), isphone = /(?:iphone)/.test(ua) && !istablet, ispc = !isphone && !isandroid && !issymbian; return { istablet: istablet, isphone: isphone, isandroid: isandroid, isios: isios, ispc: ispc }; }(); // 判断是否微信 function is_weixin(){ var ua = navigator.useragent.tolowercase(); if(ua.match(/micromessenger/i)=="micromessenger") { return true; } else { return false; } } if(!os.ispc){ $('body').addclass('is-iphone'); }else{ $('body').addclass('is-pc'); } if(os.isandroid){ $('body').addclass('is-android'); } if(os.isios){ $('body').addclass('is-ios'); } if(is_weixin()){ $('body').addclass('is-wx'); }else{ $('body').addclass('not-wx'); } // 单选框 $('.check-list label').on(tap, function(){ $(this).parent('li').addclass('is-checked').siblings().removeclass('is-checked'); }); // 视频 $('.btn-open_video').on(tap, function(){ $('.modal-video').modal('show'); }); $('[data-toggle="tab"]').on(tap, function(){ var id = $(this).attr('href'), $lis = $(this).parent('li'); $(this).tab('show'); $lis.addclass('active').siblings().removeclass('active'); }); /******************************/ /*** 公共 ****/ // 导航 $('.head-navlist > li').on('mouseenter', function(){ $(this).addclass('active') .find('.subnav-box').stop(true, true).slidedown(300) .end() .siblings('li').removeclass('active') .find('.subnav-box').hide(); if ($(this).hasclass('has-subnav')) $('.header').addclass('open-subnav'); }).on('mouseleave', function(){ $(this).removeclass('active').find('.subnav-box').hide(); $('.header').removeclass('open-subnav'); $('.head-navlist > li.current').addclass('active'); }); $('.head-menu.web').on('click', function(){ $('.modal-webnav').modal('show'); $('body').addclass('open-webnav'); }); $('.modal-webnav').on('hide.bs.modal', function () { $('body').removeclass('open-webnav'); }); // 移动端导航弹窗 $('.head-menu.app').on('click', function(){ $('.modal-appnav').modal('show'); $('body').addclass('open-appnav'); }); $('.modal-appnav').on('hide.bs.modal', function () { $('body').removeclass('open-appnav'); }); $('.modal-appnav .navlv1 .handle') .on(tap, function() { var $lis = $(this).parents('li').eq(0); if (!$lis.hasclass('in')) { $lis.addclass('active') .find('.subnav-box').stop(true, true).slidedown(300, function() { $lis.addclass('in'); }) .end() .siblings('li').removeclass('in active') .find('.subnav-box').stop(true, true).slideup(300, function() { $(this).find('li').removeclass('in active'); }); } else { $lis.removeclass('active') .find('.subnav-box').stop(true, true).slideup(300, function() { $lis.removeclass('in'); $(this).find('li').removeclass('in active'); }) } }); // 搜索框 $('.btn-sch_open').on(tap, function() { $('body').addclass('open-schbox'); $('.modal-schbox').stop(true, true).fadein(300, function() { $('.btn-sch_open').hide(); $('.btn-sch_close').css('display', 'block'); }); }); $('.btn-sch_close').on(tap, function() { $('.modal-schbox').stop(true, true).fadeout(300, function() { $('.btn-sch_close').hide(); $('.btn-sch_open').css('display', 'block'); $('body').removeclass('open-schbox'); }); }); $('.modal-webnav, .modal-appnav').on('show.bs.modal', function(){ $('.modal-schbox').stop(true, true).fadeout(300, function() { $('.btn-sch_close').hide(); $('.btn-sch_open').css('display', 'block'); $('body').removeclass('open-schbox'); }); }); // 底部技术支持 if($('.foot-jszc_swip').length){ var footjsswip = new swiper('.foot-jszc_swip', { direction: 'vertical', autoplay: { delay: 1000, disableoninteraction: false, }, loop: true, observer:true, observeparents:true, }); } // 底部友情链接 if($('.foot-link').length){ $('.foot-link .hd').on(tap, function(e){ stopbubble(e); $('.foot-link').toggleclass('is-open'); $('.foot-link .dropbox').stop(true,true).slidetoggle(300); }); $('.foot-link .dropbox').on(tap, function(e){ stopbubble(e); }); $(document).on(tap, function(){ $('.foot-link').removeclass('is-open'); $('.foot-link .dropbox').stop(true,true).slideup(300); }); } // 内页移动端二级导航 $('.inside-applv2 .lv2hd a').on(tap, function(){ $('.inside-applv2').toggleclass('open-subnav'); $('.inside-applv2 .lv2bd').stop(true, true).slidetoggle(300); }); $(window).on('load scroll', function(){ var winw = parseint($(window).width()); var wtop = $(window).scrolltop(); if($('.inside-applv2').length > 0 && !$('body').hasclass('head-white')){ var lvtop = parseint($('.inside-banbox').outerheight()) - parseint($('.header').outerheight()); if(winw < 768){ if(wtop >= lvtop){ $('body').addclass('lv2-fixed'); }else{ $('body').removeclass('lv2-fixed'); } }else{ $('body').removeclass('lv2-fixed'); } } }); // 浏览器窗口resize $(window).on('resize', function(){ var winw = parseint($(window).width()); if(winw < 992){ if($('body').hasclass('open-webnav')){ $('.modal-webnav').modal('hide'); } }else{ if($('body').hasclass('open-appnav')){ $('.modal-appnav').modal('hide'); } } if(winw > 767){ $('body').removeclass('lv2-fixed'); } }); /*** 公共 end ****/ // 新闻-筛选 $(".mfilt-select .hd").on(tap, function(e){ stopbubble(e); var $sel = $(this).parents('.mfilt-select'); $sel.siblings('.mfilt-select').removeclass('active').find('.bd').stop(true,true).slideup(300); if($sel.hasclass('active')){ $sel.find('.bd').stop(true,true).slideup(300, function(){ $sel.removeclass('active'); }); }else{ $sel.addclass('active').find('.bd').stop(true,true).slidedown(300); } }); $(".mfilt-select .bd").on(tap, function(e){ stopbubble(e); }); $(".mfilt-select .bd .list a").on(tap, function(e){ var $sel = $(this).parents('.mfilt-select'); var txt = $(this).text(); $sel.find('.hd').html(''+ txt +''); $sel.removeclass('active').find('.bd').stop(true,true).slideup(300); }); $(document).on(tap, function(){ $('.mfilt-select').removeclass('active').find('.bd').stop(true,true).slideup(300); }); // 筛选-年份 // $('#mfiltyear .bd a').on('click', function(){ // var year = $(this).attr('data-val'); // $('#mfiltyear .hd a').attr('data-year', year); // }); // // 筛选-月份 // $('#mfiltmonth .bd a').on('click', function(){ // var month = $(this).attr('data-val'); // $('#mfiltmonth .hd a').attr('data-month', month); // }); // // 筛选-类型 // $('#mfilttype .bd a').on('click', function(){ // var type = $(this).attr('data-val'); // $('#mfilttype .hd a').attr('data-type', type); // }); $(window).on('load', function(){ // 新闻列表 if($('.news-list').length){ $('.news-list li').addclass('wow fadeinup2'); } if($('.global-paging').length){ $('.global-paging').addclass('wow fadeinup2'); } // 党群园地 if($('.party-list').length){ $('.party-list li').addclass('wow fadeinup2'); } // 人才招聘 if($('.p-hr').length){ $('.hr-top .word1, .hr-top .word2, .hr-th, .hr-list li').addclass('wow fadeinup2'); } // 公告列表 if($('.notice-list').length){ $('.notice-list li').addclass('wow fadeinup2'); } // 集团简介 if($('.g-lvtit').length){ $('.g-lvtit').addclass('wow fadeinup2'); } if($('.about-box').length){ $('.about-introd .top, .about-introd .doc, .about-sect2 .doc').addclass('wow fadeinup2'); } // 组织架构 if($('.gorg-box').length){ $('.org-imgs').addclass('wow fadeinup2'); } // 社会责任报告 if($('.crs-list').length){ $('.crs-list .item').addclass('wow fadeinup2'); } // 联系我们 if($('.t-head').length){ $('.t-doc').addclass('wow fadeinup2'); } if($('.contt-mbox').length){ $('.contt-mbox').addclass('wow fadeinup2'); } // 企业文化-热电人文 if($('.cult-list').length){ $('.cult-list li').addclass('wow fadeinup2'); } // 企业文化-资质荣誉 if($('.honor-list').length){ $('.honor-list li').addclass('wow fadeinup2'); } // 搜索结果页 if($('.p-search').length){ $('.search-inpt, .search-num').addclass('wow fadeinup2'); } // 定期报告 if($('.inside-lv3list').length){ $('.inside-lv3list').addclass('wow fadeinup2'); } // 股票信息 if($('.stock-box').length){ $('.stock-databox .company, .stock-left, .stock-right, .stock-imgs').addclass('wow fadeinup2'); } // 投资者关系 if($('.tzz-row').length){ $('.tzz-row').addclass('wow fadeinup2'); } if(wow){ wow.init(); } }); // 投资者关系 $('.invest-tablist a').on('mouseenter click', function(){ var id = $(this).attr('data-href'); $(this).parents('li').addclass('active').siblings().removeclass('active'); $(id).addclass('in').stop(true,true).fadein(300, function(){ $(id).addclass('active') .find('.wow').addclass('animated') .css({ 'visibility': 'visible', 'animation-name': 'fadeinup2' }); }).siblings('.invest-pane').removeclass('in active').hide(); });